tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ariel Valentin" <asvb...@hotmail.com>
Subject RE: How to get the offending uri when handling a 404 error?
Date Thu, 03 Jun 2004 02:19:26 GMT
I believe the ErrorData class only holds 500 errors.
To get the 404 url use the getRequestURL method of HttpServletRequest:
request.getRequestURL()
That returns a string representation of the URL that generated the request.
Your might also consider setting up a filter that recognizes and logs those 
bad requests.

Hope that helps,

Mr. Ariel S. Valentin
mailto: asvb278@hotmail.com




>From: "Mike Curwen" <gb_dev@gb-im.com>
>Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
>To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
>Subject: RE: How to get the offending uri when handling a 404 error?
>Date: Wed, 2 Jun 2004 09:37:48 -0500
>
>I got a related question:
>
>Even if you fail to set the isErrorPage directive, would you still be
>able to access the information through the request attributes?
>
>such as:
>javax.servlet.error.request_uri
>
>
>
> > -----Original Message-----
> > From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
> > Sent: Wednesday, June 02, 2004 7:50 AM
> > To: Tomcat Users List
> > Subject: RE: How to get the offending uri when handling a 404 error?
> >
> >
> >
> > Hi,
> > Does your 404.jsp have the isErrorPage directive set to true?
> >
> > Yoav Shapira
> > Millennium Research Informatics
> >
> >
> > >-----Original Message-----
> > >From: Joseph Shraibman [mailto:jks@selectacast.net]
> > >Sent: Tuesday, June 01, 2004 7:57 PM
> > >To: tomcat-user@jakarta.apache.org
> > >Subject: How to get the offending uri when handling a 404 error?
> > >
> > >I put this in my web.xml:
> > >
> > ><error-page>
> > ><error-code>404</error-code>
> > ><location>/404.jsp</location>
> > ></error-page>
> > >
> > >... and this in 404.jsp:
> > >
> > >ErrorData ed = pageContext.getErrorData();
> > >if (ed != null) url = ed.getRequestURI() ;
> > >
> > >but it throws:
> > >
> > >StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw
> > >exception java.lang.NullPointerException
> > >java.lang.NullPointerException
> > >         at
> > >javax.servlet.jsp.PageContext.getErrorData(PageContext.java:514)
> > >         at org.apache.jsp._404_jsp._jspService(_404_jsp.java:102)
> > >         at
> > >org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
> > >         at
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
> > >         at
> > >org.apache.jasper.servlet.JspServletWrapper.service(JspServle
> > tWrapper.j
> > ava:
> > >298)
> > >         at
> > >org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServle
> > t.java:292
> > )
> > >         at
> > >org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
> > >
> > >(this is with tomcat 5.0.24)
> > >
> > >So how can I get the url the the user tried to request?
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
> >
> > This e-mail, including any attachments, is a confidential
> > business communication, and may contain information that is
> > confidential, proprietary and/or privileged.  This e-mail is
> > intended only for the individual(s) to whom it is addressed,
> > and may not be saved, copied, printed, disclosed or used by
> > anyone else.  If you are not the(an) intended recipient,
> > please immediately delete this e-mail from your computer
> > system and notify the sender.  Thank you.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

_________________________________________________________________
Check out the coupons and bargains on MSN Offers! http://youroffers.msn.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message