tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bragg, Casey" <Casey.Br...@allegiancetelecom.com>
Subject Using Error Pages? : Still stuck... More info...
Date Thu, 19 Jul 2001 19:43:24 GMT
I left some info out of my question...

(BTW - the mailing list archive is filled with this question over and over
with few solutions)

My ROOT context has a valve entry in it.  The valve is running the
sendError.

The question :
   Why does my custom 404 error page work, but my nearly identical 403 page
does not work (I get the standard 403 message instead)?

>From server.xml : 

   <Context path="" docBase="ROOT" debug="999">
      <Valve className="tman.ManagerValve"/>
   </Context>

>From tman.ManagerValve.invoke() (tman.MAnagerValve extends
org.apache.catalina.valves.ValveBase) : 

        // to deny
          if ((requestURI!=null)&&(requestURI.indexOf("/deny")>=0)) {
		ServletResponse sres = response.getResponse();
		if (sres instanceof HttpServletResponse) {
		    HttpServletResponse hres = (HttpServletResponse) sres;
		    hres.sendError(HttpServletResponse.SC_FORBIDDEN);
                    log("process end : " +
HttpServletResponse.SC_FORBIDDEN);
		    return;
		}
          }

        // to allow
		context.invokeNext(request, response);
                log("process end");
		return;

==============================================
Casey Bragg - Software Engineer
Allegiance Telecom, Inc.  Dallas, TX
469-259-2702 - casey.bragg@allegiancetelecom.com
==============================================


-----Original Message-----
From: Bragg, Casey [mailto:Casey.Bragg@allegiancetelecom.com]
Sent: Thursday, July 19, 2001 10:44 AM
To: tomcat-user@jakarta.apache.org
Subject: Using Error Pages


Hello : 

I can't get my 403 (forbidden) error page to show up.  Instead, I get the
standard 403 error message on my browser (yes, friendly error messages are
turned off on IE).  My 404 page works and its virtually identical to my 403
page.  What am I doing wrong?



I have the following entry in my ROOT/WEB-INF/web.xml :

   <error-page>
      <error-code>403</error-code>
      <location>/security/status/forbidden.jsp</location>
   </error-page>
   <error-page>
      <error-code>404</error-code>
      <location>/security/status/notfound.jsp</location>
   </error-page>



The following messages appear in my logs : 

XmlMapper: new null org.apache.catalina.deploy.ErrorPage error-page
ErrorPage[errorCode=0, location=null]
XmlMapper: org.apache.catalina.deploy.ErrorPage.setErrorCode( 403)
XmlMapper: org.apache.catalina.deploy.ErrorPage.setErrorCode( )
XmlMapper: org.apache.catalina.deploy.ErrorPage.setLocation(
/security/status/forbidden.jsp)
XmlMapper: org.apache.catalina.deploy.ErrorPage.setLocation( )
XmlMapper: Calling org.apache.catalina.core.StandardContext.addErrorPage
ErrorPage[errorCode=403, location=/security/status/forbidde
n.jsp]
XmlMapper: pop error-page org.apache.catalina.deploy.ErrorPage:
ErrorPage[errorCode=403, location=/security/status/forbidden.jsp]
XmlMapper: new null org.apache.catalina.deploy.ErrorPage error-page
ErrorPage[errorCode=0, location=null]
XmlMapper: org.apache.catalina.deploy.ErrorPage.setErrorCode( 404)
XmlMapper: org.apache.catalina.deploy.ErrorPage.setErrorCode( )
XmlMapper: org.apache.catalina.deploy.ErrorPage.setLocation(
/security/status/notfound.jsp)
XmlMapper: org.apache.catalina.deploy.ErrorPage.setLocation( )
XmlMapper: Calling org.apache.catalina.core.StandardContext.addErrorPage
ErrorPage[errorCode=404, location=/security/status/notfound
.jsp]
XmlMapper: pop error-page org.apache.catalina.deploy.ErrorPage:
ErrorPage[errorCode=404, location=/security/status/notfound.jsp]



My code is purposely throwing the following : 

HttpServletResponse hres = (HttpServletResponse) sres;
hres.sendError(HttpServletResponse.SC_FORBIDDEN);

Thanks!

...Casey

==============================================
Casey Bragg - Software Engineer
Allegiance Telecom, Inc.  Dallas, TX
469-259-2702 - casey.bragg@allegiancetelecom.com
==============================================

Mime
View raw message