You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Schreibman, David" <DS...@ConveySoftware.com> on 2002/03/22 22:23:24 UTC

[PATCH] TC3.3.1 sendError(404, msg) ignores msg

Short version:

	Here's a patch that modifies the NotFoundHandler to incorporate the
msg from sendError(sc, msg) into the html response body.  Currently, the
passed in msg is ignored.

Long version:

I know the servlet spec lets the server decide what the response body will
contain, and I know the ErrorHandler is just a default, but is there an
important reason why the NotFoundHandler shouldn't incorporate the msg ?

Currently if you call sendError(404, msg), the returned response does not
include the message because it gets sent to the NotFoundHandler (which
ignores it).  Other status codes go through the StatusHandler and the
specified msg is incorporated into the response.

I can't think of an important reason to suppress the msg and think it might
be nice to see it.  That way you could easily use sendError to send back an
href or other information giving the user a way to report a problem or get
help.  This came up for us when a page we had served up had a bad link in
it.  I know there are better ways to do this but having sendError honor the
msg on a 404 is cheap and lets us get out an easy fix while we work on
something better ...

Anyway, here it is in case anyone else thinks it's a good idea.

Cheers,

-David