W3C home > Mailing lists > Public > www-jigsaw@w3.org > January to February 2002

Re: wrong status code in HTTP Header

From: Yves Lafon <ylafon@w3.org>
Date: Tue, 22 Jan 2002 16:30:17 +0100 (MET)
To: Stefanie Wiemann <s.wiemann@ais-gmbh.de>
cc: <www-jigsaw@w3.org>
Message-ID: <Pine.GSO.4.33.0201221626150.19840-100000@tarantula.inria.fr>
On Fri, 7 Dec 2001, Stefanie Wiemann wrote:

>
> Hi,
>
> I wrote a servlet which handles HTTP requests sent by an SAP server.
> After processing the data an answer with the correct HTTP status code
> must be returned (e.g. 201 if a document has been created or 404 if a
> document could not be found).
>
> I use the setStatus(int status) method of the
> javax.servlet.http.HttpServletResponse class to set the HTTP status
> which shall be returned to the client. This works fine with Tomcat and
> JRun.
> But with Jigsaw I always get 200 (which is the default, I think). The
> other parts of the servlet execute fine, e.g. documents are created as
> expected. Only the return code is not set correctly.
>
> Am I missing something?

When you get the stream to write on it, Jigsaw will start writing the
reply. So to be able to change the response code or any HTTP header, you
have to do it before actually sending bytes on the wire.
Regards,

-- 
Yves Lafon - W3C
"Baroula que barouleras, au tiéu toujou t'entourneras."
Received on Tuesday, 22 January 2002 10:30:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:36 GMT