|
|
|
[
Permlink
| « Hide
]
Andres March - [14/Jan/05 07:29 PM ]
Please indicate a class which has this issue and I will have a look.
version: 2.0.2
package: com.opensymphony.oscache.web.filter class: CacheFilter method: doFilter the firts 4 lines are: log.info("<cache>: filter in scope " + cacheScope); HttpServletRequest httpRequest = (HttpServletRequest) request; String key = admin.generateEntryKey(null, httpRequest, cacheScope); Cache cache = admin.getCache(httpRequest, cacheScope); The 4th line is the problem, because if calls: com.opensymphony.oscache.web.ServletCacheAdministrator.getCache: public Cache getCache(HttpServletRequest request, int scope) { if (scope == PageContext.APPLICATION_SCOPE) { return getAppScopeCache(request.getSession(true).getServletContext()); } [...] } as you see in case of scope == PageContext.APPLICATION_SCOPE there is a call to request.getSession(true) which creates a new session. The real problem is that this is the only way to get the ServletContext, so I made my own modified Filter class which notes down the ServletContext during the init() method and then uses it to do the work. I added
Cache cache; if (cacheScope == PageContext.APPLICATION_SCOPE) { cache = admin.getAppScopeCache(config.getServletContext()); } else { cache = admin.getCache(httpRequest, cacheScope); } to the CacheFilter which should fix this. | |||||||||||||||||||||||||||||||||||||||