[EMAIL PROTECTED] wrote: > I'm having some trouble getting the c:import tag to work right. > It seems to be perfectly fine when the request that tomcat receives is > a GET request. However, when it receives a HEAD request instead, c:import > never actually reads the data.
> System.out.println("FOO:[" + pageContext.getAttribute("foo") + "]"); Logically, why would you expect a pageContext to be created in the absence of a request for a "page"? :-) However, from the Servlet Spec -- protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Receives an HTTP HEAD request from the protected service method and handles the request. The client sends a HEAD request when it wants to see only the headers of a response, such as Content-Type or Content-Length. The HTTP HEAD method counts the output bytes in the response to set the Content-Length header accurately. If you override this method, you can avoid computing the response body and just set the response headers directly to improve performance. <snip/>... So it sounds like Tomcat's doHead() is doing exactly that. Which means the Content-Length value supplied (test: TC 5.5.9) is different for a GET vs. HEAD request in your scenario. Which sounds bad to me, but the HTTP 1.1 spec says -- 9.4 HEAD The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. <snip/>... I'd think the SHOULD above would be a MUST, but since it's not, it's apparently "legal", if (IMHO) ill-advised, to return different values of Content-Length for HEAD and GET requests for the same object. Trying a similar test with Apache httpd (2.0.52), though, results in *no* Content-Length returned from a HEAD request for a page with a dynamic include component, while HEAD/GET requests for a static page each return the same Content-Length value. So is the Tomcat behavior a bug? I'd at least call it undesirable, but the easiest and most performant fix would be for doHead() to not return Content-Length at all; the more-useful-but-slower approach would be to build the page/count bytes/discard and I'm not sure I'd want to see that... Perhaps someone else will have an opinion :-) -- Hassan Schroeder ----------------------------- [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]