tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Osterlie <thomas.oster...@consultit.no>
Subject Servlet handling Apache errors
Date Sat, 28 Jul 2001 13:35:03 GMT
Hi,

For days I've been searching the Internet for clues as to how to solve
this problem. I'm using Tomcat 3.2.3 connected to Apache 1.3.19 through
mod_jk.

The situation is as follows: when Apache comes up with a 404 error we're
using Apache's ErrorDocument to pass control on to a new program which
searches the files availbale to the web server for possible file name
matches according to certain criterias. These possible matches are
returned as links in the 404 error page. We used to do this by pointing
the ErrorDocument 404 to a PHP page.

With PHP this is simple, as we can make use of Apache's environment
variables to figure out the original request URI. A new customer is
interested in the same functionality, but wants us to use servlet instead
of PHP.

My Apache server, foo.bar, has

  ErrorDocument 404 /myServlet/errorHandler

in its httpd.conf.

When a client requests http://foo.bar/foobar.html and foobar.html doesn't
exist, a 404 error occurs. Because of the ErrorDocument directive in
httpd.conf, Apache invokes the errorHandler servlet. However, no traces of
the original request to http://foo.bar/foobar.html is available to the
servlet. Servlets run out of Apache's process space and therefore
has no access to Apache's environment variables, so we saw this one
coming.

However, in order to search for likely candidates to be returned with the
error page, this information needs to be made available to the servlet in
some way or another. Anyone got any clue as to how we may solve this
situation? Is it possible to pass some of the environment variables as
paramters in the ErrorDocument directive?

Thanks,

Thomas Osterlie
Consultant, ConsultIT A/S
URI: http://www.consultit.no
E-mail: thomas.osterlie@consultit.no



Mime
View raw message