mLogger.debug("entering");
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
PlanetRequest planetRequest = null;
try {
planetRequest = new PlanetRequest(request);
} catch(Exception e) {
// some kind of error parsing the request
mLogger.error("error creating planet request", e);
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
String key = "planetCache:"+this.generateKey(planetRequest);
try {
ResponseContent respContent = null;
if(!this.excludeOwnerPages || !planetRequest.isLoggedIn()) {
respContent = (ResponseContent) this.mCache.get(key);
}
if(respContent == null) {
mLogger.debug("MISS "+key);
this.misses++;
CacheHttpServletResponseWrapper cacheResponse =
new CacheHttpServletResponseWrapper(response);
chain.doFilter(request, cacheResponse);
cacheResponse.flushBuffer();
// only cache if we didn't get an exception
if (request.getAttribute("DisplayException") == null) {
ResponseContent rc = cacheResponse.getContent();
// only cache if this is not a logged in user?
if(!this.excludeOwnerPages || !planetRequest.isLoggedIn()) {
this.mCache.put(key, rc);
} else {
mLogger.debug("SKIPPED "+key);
this.skips++;
}