tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Assia Djambazova <kirker...@gmail.com>
Subject HttpServletResponse.sendError - missing message in error page
Date Thu, 26 Jul 2018 11:46:27 GMT
Hello,

I noticed that when using HttpServletResponse.sendError in Tomcat 7.0.90
with string message the message is no longer shown as the response is
displayed.

I reproduce this with request to simple servlet:



*    public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
 response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "TEST
ERROR MESSAGE");    }*

The result in the browser is different:

In Tomcat 7.0.90  HTTP Status 500 ? Internal Server Error

In Tomcat 7.0.88  HTTP Status 500 - TEST ERROR MESSAGE

I think that this change is the cause [1]

However, this change looks incompatible with servlet spec and breaks our
integration tests. It seems to me from the spec [2] that the message should
be displayed: *The server defaults to creating the response to look like an
HTML-formatted server error page containing the specified message, setting
the content type to "text/html"*

I use the ErrorReportValve and showReport is set to false. Reading [3]
doesn't clarify if error message is part of the error report or not and if
it should be displayed.

Thanks,
Assia


[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60490
[2]
https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpServletResponse.html#sendError-int-java.lang.String-
[3]
https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Error_Report_Valve

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message