Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > problems with get status code from servlet response

Reply
Thread Tools

problems with get status code from servlet response

 
 
Michelle X.
Guest
Posts: n/a
 
      07-05-2005
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.

 
Reply With Quote
 
 
 
 
William Brogden
Guest
Posts: n/a
 
      07-06-2005
On 5 Jul 2005 15:41:01 -0700, Michelle X. <(E-Mail Removed)>
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


 
Reply With Quote
 
 
 
 
Andrea Desole
Guest
Posts: n/a
 
      07-06-2005


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I get the servlet access url from servlet context shaoanqing@gmail.com Java 4 04-20-2007 09:10 AM
Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response javadev Java 5 11-16-2006 11:22 AM
Correct HTTP response status code on "Access Denied" page. diarmaid@calvert.com ASP General 0 08-29-2005 07:23 PM
Servlet question(Tomcat, web.xml, servlet-class, servlet-name) circuit_breaker Java 2 04-04-2004 03:26 AM
how to get my servlet configuration before the servlet is initialised Andy Fish Java 4 12-17-2003 09:47 PM



Advertisments