response.containsHeader("Content-Type") always returns false even if the header is explicitly added via response.setHeader("Content-Type", "text/html"). To reproduce, simply add the following to a filter or servlet: response.setHeader("Content-Type", "text/html"); System.out.println(response.containsHeader("Content-Type")); The difficult question (for which the Servlet spec is silent) will be what to return for response.containsHeader("Content-Type") if the header was set using the response.setContentType() method. I think the spec is pretty clear that if setHeader is used, containsHeader should work for any header. Thanks... Sean
This has now been fixed in SVN. Based on the wording on the spec for setContentLength() which states that calling this method sets the Content-Length header for HTTP servlets, containsHeader() now returns true if the Content-Length or Content-Type has been set directly by setHeader or indirectly by setContentLength() etc.