tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Friedman, Eric" <>
Subject error-page, setStatus, and sendError
Date Thu, 19 Oct 2000 22:21:15 GMT

[Tomcat 3.2b6; java 1.3; solaris 8; apache 1.3.12]

I have a servlet which should either return status 200 (OK) or 406
(NOT_ACCEPTABLE) based on the success/failure of some XML input.  In both
cases, the body of the response should contain an XML message.

I am unable to get tomcat to include my XML message with the 406 response;
instead I get the standard 406 HTML message (this is true through apache and
through tomcat's internal HTTP listener).

I have tried:

1. setting the status code on the response and writing the XML to the
response object's Writer.
2. adding an <error-page> directive in my web.xml file to use a servlet or
html file for servlets that produce status code 406.
3. #2 + calling sendError(response.SC_NOT_ACCEPTABLE) instead of setStatus()
4. adding an <error-page> directive for a named exception and then throwing
that exception in my servlet.

None of these have worked.  I've also tried tomcat 3.1 to no avail.

Suggestions/solutions greatly appreciated.


View raw message