tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier (tomcat) ...@ice-sa.com>
Subject Re: AW: Status-Code of error-pages is always http-200?
Date Mon, 05 Sep 2016 15:44:04 GMT
On 05.09.2016 14:28, Matthias Ludwig wrote:
> Problem solved: It was a programming error in my own code. I set the status
> myself to 200.

I can only say : it is a pity. With an issue so well described, it would have been a 
pleasure to search the Tomcat code for the reason.
But in my experience, it is often so : when one really takes the time to analyse an issue

systematically, with the purpose of explaining a problem to others, one often finds the 
error by himself as a result.

Thank you in any case for the good original post, and for the follow-up message.
If only all the people posting here could always do the same..

>
> -----Urspr√ľngliche Nachricht-----
> Von: Matthias Ludwig [mailto:matthias-ludwig@gmx.net]
> Gesendet: Montag, 5. September 2016 11:24
> An: users@tomcat.apache.org
> Betreff: Status-Code of error-pages is always http-200?
>
> Hello,
>
> I'm using the servlet error-page Mechanism. I tried this under Tomcat 8.0.23
> and 8.5.4.
>
> Background: I'm trying to implement a REST-Web-Service. Therefore I have to
> combine error-http-status with json/xml in the response body for further
> error information.
>
> I experienced the following:
>
> Test 1
> Servlet A calls response. setStatus (code) with code >= 400 This has no
> effect on the response (http-status 200)
>
> Test 2
> Servlet A calls response.sendError(code) with code >= 400 My web-xml
> specifies an error-page handler-Servlet B.
> Servlet B writes to the response-output-stream
>
> The resulting response from tomcat has http result code 200. I expected the
> origin http-result-code of Servlet A.
>
> I tried to call response.setStatus in the error-page-handler (Servlet B).
> There is no effect.
> I tried to call response.sendError in the error-page-handler (Servlet B). ->
> Exception "Cannot set response after response has been committed.
>
> Is it default behaviour of tomcat that the error-pages have status code 200
> ?
> If yes: Is there any possibility to modify this behaviour? With
> configuration? I' trying to avoid any complicate hacks.
> Are I'm doing anything wrong?
> Any other ideas that could help me?
>
> Thank you very much for any response.
>
> Matthias
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message