Re: Using Error Pages? : Still stuck... More info...

2001-07-19 Thread Craig R. McClanahan



On Thu, 19 Jul 2001, Bragg, Casey wrote:

> 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)?
> 

This isn't going to work :-(

The reason is that Valves are processed *before* the webapp-related things
are, so things like error page directives are not invoked on the return
value from a Valve.

A possible alternative would be to implement your ManagerValve
functionality as a Filter instead.  That way, it would be processed
"inside" the webapp, and error pages would be applied.

As an extra added bonus, you would be portable to other containers as well
:-).

Craig





Using Error Pages? : Still stuck... More info...

2001-07-19 Thread Bragg, Casey

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 : 

   
  
   

>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 - [EMAIL PROTECTED]
==


-Original Message-
From: Bragg, Casey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 10:44 AM
To: [EMAIL PROTECTED]
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 :

   
  403
  /security/status/forbidden.jsp
   
   
  404
  /security/status/notfound.jsp
   



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 - [EMAIL PROTECTED]
==



Using Error Pages

2001-07-19 Thread Bragg, Casey

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 :

   
  403
  /security/status/forbidden.jsp
   
   
  404
  /security/status/notfound.jsp
   



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 - [EMAIL PROTECTED]
==