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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to