From: Greg W. <gr...@mo...> - 2005-05-24 09:53:46
|
Of course if you are happy to always run in Jetty, you can just leave out the NoBodyOutputStream and Jetty will remove the body for you. The doHead code should be able to just call doGet and perform the normal processing (and setting of headers) as it really should do. Jetty should even make the same decisions about when to flush headers etc. which could effect the choice of chunking or not chunking! cheers Laurent Martelli wrote: >>>>>>"Greg" == Greg Wilkins <gr...@mo...> writes: > > > Greg> Laurent Martelli wrote: > >> Hi, > >> > >> I think javax.servlet.http.NoBodyResponse and > >> javax.servlet.http.NoBodyOutputStream should not be private > >> classes so that they can be usedwhen overriding doHead(). > > Greg> I agree totally.... well almost totally..... In fact I do not > Greg> think it is the job of the servlet API to enforce the no-body > Greg> part of a HEAD request. That is the job of the HTTP layer! > > Greg> Anyway, while I'd like to help we cannot change these classes > Greg> without causing us to fail the conditions of the TCK spec > Greg> compliance stuff. > > I guess these 2 classes are implementation specific and are not part > of the spec. So maybe you could move them to a jetty specific package. > > I also noticed that the default implementation of doHead() always sets > the Content-Length. And this is the reason why I had to override > it. Since HEAD request do not return a body, it is probably very > common optmization for dynamically generated pages, to not generate > the pages at all. This leads to a Content-Length of 0 which may fool > the browser into thinking the document is empty. I would say it's > probably better to leave out the Content-Length unless the > implementation sets it. > |