|
|
|
@ -109,15 +109,13 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H |
|
|
|
MediaType mediaType = getMediaType(resource); |
|
|
|
MediaType mediaType = getMediaType(resource); |
|
|
|
if (mediaType != null) { |
|
|
|
if (mediaType != null) { |
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
logger.debug("Determined media type [" + mediaType + "] for " + resource); |
|
|
|
logger.debug("Determined media type '" + mediaType + "' for " + resource); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
if (logger.isDebugEnabled()) { |
|
|
|
logger.debug("No media type found for " + resource + " - returning 404"); |
|
|
|
logger.debug("No media type found for " + resource + " - not sending a content-type header"); |
|
|
|
} |
|
|
|
} |
|
|
|
response.sendError(HttpServletResponse.SC_NOT_FOUND); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// header phase
|
|
|
|
// header phase
|
|
|
|
@ -207,8 +205,11 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H |
|
|
|
throw new IOException("Resource content too long (beyond Integer.MAX_VALUE): " + resource); |
|
|
|
throw new IOException("Resource content too long (beyond Integer.MAX_VALUE): " + resource); |
|
|
|
} |
|
|
|
} |
|
|
|
response.setContentLength((int) length); |
|
|
|
response.setContentLength((int) length); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mediaType != null) { |
|
|
|
response.setContentType(mediaType.toString()); |
|
|
|
response.setContentType(mediaType.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Write the actual content out to the given servlet response, |
|
|
|
* Write the actual content out to the given servlet response, |
|
|
|
|