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

Discussion in 'Java' started by Anders Skar, Jul 20, 2004.

  1. Anders Skar

    Anders Skar Guest

    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 Skar, Jul 20, 2004
    #1
    1. Advertising

  2. Anders Skar

    Anders Skar Guest

    (Anders Skar) wrote in message news:<>...
    > 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
     
    Anders Skar, Jul 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aleksi Kallio
    Replies:
    1
    Views:
    1,033
    John C. Bollinger
    Aug 4, 2003
  2. Mupota Muchelemba
    Replies:
    1
    Views:
    949
    Tony Morris
    Feb 4, 2004
  3. circuit_breaker
    Replies:
    2
    Views:
    2,081
    Jack Jia
    Apr 4, 2004
  4. Doug McCann
    Replies:
    1
    Views:
    1,138
    William Brogden
    Aug 5, 2004
  5. IanR
    Replies:
    2
    Views:
    307
    Albert Hopkins
    Mar 12, 2009
Loading...

Share This Page