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.
William Brogden - 06 Jul 2005 16:04 GMT
> 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
Andrea Desole - 06 Jul 2005 16:47 GMT
> 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