During a HEAD request, when a RequestDispatcher include is handled by the DefaultServlet the content of the static resource is not written to the HttpServletResponse. If the including servlet has wrapped the response before performing the include it will not receive the content of the resource. This causes an issue for the JSTL <c:import> tag when a relative url is used in order to retrieve the resource, for example for use with the <x:parse> tag. Bug 37466 describes this case. It is also a problem for other requests where the response headers may be affected by this lack of content causing different header values to be returned for GET vs. HEAD methods. For example, the Content-Length header does not account for bytes that are emitted by the included resource.
Created attachment 32497 [details] Patch with test case and possible fix Patch that adds a test cases checking the Content-Length for GET and HEAD requests to a JSP page that includes a static resource. Possible fix by checking the DispatcherType in DefaultServlet#doHead()
Fixed in trunk, 8.0.x for 8.0.21 onwards and in 7.0.x for 7.0.60 onwards.