problems with get status code from servlet response

M

Michelle X.

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.
 
W

William Brogden

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
 
A

Andrea Desole

Michelle said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top