problems with get status code from servlet response

Discussion in 'Java' started by Michelle X., Jul 5, 2005.

  1. Michelle X.

    Michelle X. Guest

    I am trying to create a filter that logs any request for a invalid url.
    So in my filter, I need to exam any servlet response to see if it
    contains status error code 404. But I couldn't find any methods to
    get the content of the response such as status line, seem like
    HttpServletResponse class only provides ways to change response instead
    of looking into the response.
    Michelle X., Jul 5, 2005
    #1
    1. Advertising

  2. On 5 Jul 2005 15:41:01 -0700, Michelle X. <>
    wrote:

    > I am trying to create a filter that logs any request for a invalid url.
    > So in my filter, I need to exam any servlet response to see if it
    > contains status error code 404. But I couldn't find any methods to
    > get the content of the response such as status line, seem like
    > HttpServletResponse class only provides ways to change response instead
    > of looking into the response.
    >


    I suppose you could create an extension of HttpServletResponseWrapper
    that overrides sendError methods and lets the filter see what has been set.
    Bill
    William Brogden, Jul 6, 2005
    #2
    1. Advertising

  3. Michelle X. wrote:
    > I am trying to create a filter that logs any request for a invalid url.


    Wouldn't it be a better solution to log everything in the 404 page? You
    can do that with the error-page element in the web.xml
    Andrea Desole, Jul 6, 2005
    #3
    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. Andy Fish
    Replies:
    4
    Views:
    2,396
    Andy Fish
    Dec 17, 2003
  2. circuit_breaker
    Replies:
    2
    Views:
    1,978
    Jack Jia
    Apr 4, 2004
  3. Replies:
    4
    Views:
    674
    santax
    Apr 20, 2007
  4. Replies:
    0
    Views:
    413
  5. Thomas 'PointedEars' Lahn

    [FYI] MSXML HTTP translates response status code 204 to 1223

    Thomas 'PointedEars' Lahn, Sep 7, 2009, in forum: Javascript
    Replies:
    4
    Views:
    364
    Diego Perini
    Sep 16, 2009
Loading...

Share This Page