return false;
}
public void serviceResource(String resourceKey, HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
InternetResource resource;// getInternetResource(request);
try {
resource = getResourceBuilder().getResourceForKey(resourceKey);
} catch (ResourceNotFoundException e) {
throw new ServletException(e);
}
Object resourceDataForKey = getResourceBuilder().getResourceDataForKey(
resourceKey);
ResourceContext resourceContext = getResourceContext(resource, request,
response);
resourceContext.setResourceData(resourceDataForKey);
try {
if (resource.isCacheable(resourceContext) && this.cacheEnabled) {
// Test for client request modification time.
try {
long ifModifiedSince = request
.getDateHeader("If-Modified-Since");
if (ifModifiedSince >= 0) {
// Test for modification. 1000 ms due to round
// modification
// time to seconds.
long lastModified = resource.getLastModified(
resourceContext).getTime() - 1000;
if (lastModified <= ifModifiedSince) {
response.setStatus(304);
return;
}
}
} catch (IllegalArgumentException e) {
log
.warn(
Messages
.getMessage(Messages.PARSING_IF_MODIFIED_SINCE_WARNING),
e);
}
String cacheKey = resourceKey;
CachedResourceContext cachedResourceContext = new CachedResourceContext(
resourceContext);
CacheContext cacheLoaderContext = new CacheContext(
cachedResourceContext, resource);
try {
CacheContent content = (CacheContent) cache.get(cacheKey,
cacheLoaderContext);
if (log.isDebugEnabled()) {
log
.debug(Messages.getMessage(
Messages.GET_CONTENT_FROM_CACHE_INFO,
cacheKey));
}
content.sendHeaders(response);
// Correct expires date for resource.
Date expired = resource.getExpired(resourceContext);
if (expired != null) {
response.setDateHeader("Expires", expired.getTime());
} else {
response.setDateHeader("Expires", System
.currentTimeMillis()