Getting the original URL in a custom 404 error page/servlet (Tomcat)  
Author Message
anders





PostPosted: 2004-7-20 17:05:00 Top

java-programmer, Getting the original URL in a custom 404 error page/servlet (Tomcat) Hi!

I'm trying to setup a servlet to handle all request that does not map
to a file on the webserver. I've set up a error-page in web.xml that
points to my servlet. I want my servlet to lookup the requested URL
in a database.

The only problem is that when the servlet is called, I want to get the
original URL requested by the user, not the URL of my 404 servlet.

Does anyone know how to do this?

Thanks in advance for any help!

Anders
 
anders





PostPosted: 2004-7-23 3:12:00 Top

java-programmer >> Getting the original URL in a custom 404 error page/servlet (Tomcat) email***@***.com (Anders Skar) wrote in message news:<email***@***.com>...
> Hi!
>
> I'm trying to setup a servlet to handle all request that does not map
> to a file on the webserver. I've set up a error-page in web.xml that
> points to my servlet. I want my servlet to lookup the requested URL
> in a database.
>
> The only problem is that when the servlet is called, I want to get the
> original URL requested by the user, not the URL of my 404 servlet.

Found the solution myself:

request.getAttribute("javax.servlet.error.request_uri")

Anders