tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Status code 207
Date Sun, 02 Jul 2000 19:54:48 GMT
Theunis W de Jongh wrote:

> Hi all
> If I need to return a status code that is not supported in the
> Servlet2.2 API, how do I go about it ?
> Reason I ask, is that in order for a DAV compliant message header to
> be generated, status code 207 needs to be returned to the client.
> The first line of the header needs to be :
>         HTTP/1.1 207 Multi-status

The call you are looking for is

    response.sendError(207, "Multi-status");

This sets the HTTP status code (and corresponding message) that will be
included in the response.

> Is the solution to just not set the status parameter in the response
> and add the above to the header. What method would be used to add the
> single line, instead of setHeader( String, String )?
> Further on, how can one set the order of header strings in the header ?
> The DAV servlet I am currently modifying sets the header contents in
> a specific order, but they arrive at the client in a different order
> than the setting order.

It's not clear that there are any guarantees in the servlet API about the
order in which headers are delivered versus the order in which they are
set.  The container is free to do what it wants.  In practice, what happens
is that the headers are accumulated in a Hashtable keyed by header name, so
the output order ends up being the order in which the headers are

> Tomcat also appends its own header lines, among others Servlet-Engine
> and Date. I also set a  Date header, thus two headers arrive client
> side. Is there a way to suppress the Tomcat generation of headers, also
> the setting of status code to 200 ?

If you specify a header in a response.setHeader() call with the same name
as one already set, the old one should be replaced -- so whoever sets it
last should win.

> If there is a documentation set discussing these issues, please point
> me to it.

The starting place would be the relevant standards for HTTP/1.1 (RFC 2616)
and the servlet 2.2 specification.  Beyond that you will need to look at
the Tomcat source code to see what is really happening, and suggest changes
you think might be appropriate.

For WebDAV in particular, you might also be interested in the Slide project
(also hosted at the Jakarta web site), which supports a content management
API, and a WebDAV servlet, that runs on Tomcat or any other 2.2- based
servlet container.  It is nearing alpha release.  For more info, see

> Apologies if these issues have been addressed previously.
> Any replies appreciated.
> Kind regards,
> Theunis de Jongh.

Craig McClanahan

View raw message