tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve McIntyre" <smcint...@tickets.com>
Subject Trapping 404 Errors
Date Wed, 11 Oct 2000 23:26:43 GMT
I'm using tomcat 3.1 and trying to trap 404 errors when a user has specified
a servlet that does not exist. I want to return a custom page to the user in
these situations. Unfortunately, the error-page settings in the web.xml file
did not appear to work (i.e., a 404 gets returned to the browser instead of
404.html page I asked to be returned).

Anyway, I've also tried trapping the ClassNotFoundException in the
InvokerServlet (and via the web.xml file), but the exception does not make
it to this level (i.e., its trapped else where, with the response status set
to 404). As far as I can tell, no 'getStatus()' method exists on the
response object, so I can't query the response object to see its status. The
only solution I can think of is to examine the response's OutputStream...
but doing that seemed like more work then asking this group for a better
solution.

Ideas?


Steve McIntyre
Email: smcintyre@tickets.com

WEB.XML CONFIGURATIONS THAT DO NOT WORK
---------------------------------------

<error-page>
      <error-code>404</error-code>
      <location>/404.html</location>
</error-page>
<error-page>
      <exception-type>java.lang.ClassNotFoundException</exception-type>
      <location>/404.html</location>
</error-page>



Mime
View raw message