You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@locus.apache.org on 2000/08/15 01:55:38 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/service/http HttpRequestAdapter.java

costin      00/08/14 16:55:37

  Modified:    src/share/org/apache/tomcat/context Tag: tomcat_32
                        DefaultCMSetter.java
               src/share/org/apache/tomcat/core Tag: tomcat_32
                        ContextManager.java
               src/share/org/apache/tomcat/request Tag: tomcat_32
                        AccessInterceptor.java
               src/share/org/apache/tomcat/service/http Tag: tomcat_32
                        HttpRequestAdapter.java
  Log:
  IMPORTANT bug fixes for 3.2 - please review:
  
  - HttpRequestAdapter can't find "mimeHeader.connection.ioe" ( resolved in
  3.3 by having a common location for all messages )
  
  - Allow the user to use error-page for 404, 302 and 401 ( if basic
  auth is used - for FORM login we can't ). 401 may be arguable, but
  allowing the user customize it is the only way to display meaningfull
  error message if the user clicks "cancel"
  
  - Fixed error-page handling for .jsp pages - without it jasper gets the
  wrong page. In 3.3 that will be resovled by using JspInterceptor
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.45.2.1  +10 -6     jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.45
  retrieving revision 1.45.2.1
  diff -u -r1.45 -r1.45.2.1
  --- DefaultCMSetter.java	2000/06/30 20:21:11	1.45
  +++ DefaultCMSetter.java	2000/08/14 23:55:36	1.45.2.1
  @@ -92,12 +92,16 @@
   	ctx.addServlet( new ExceptionHandler());
   	ctx.addServlet( new StatusHandler());
   
  -	// Default status handlers
  -	ctx.addServlet( new RedirectHandler());
  -	ctx.addErrorPage( "302", "tomcat.redirectHandler");
  -	ctx.addServlet( new NotFoundHandler());
  -	ctx.addErrorPage( "404", "tomcat.notFoundHandler");
  -	
  +	// Default status handlers. If already set ( error-page in web.xml )
  +	// do nothing
  +	if( null==ctx.getErrorPage( "302" )) {
  +	    ctx.addServlet( new RedirectHandler());
  +	    ctx.addErrorPage( "302", "tomcat.redirectHandler");
  +	}
  +	if( null==ctx.getErrorPage( "404" )) {
  +	    ctx.addServlet( new NotFoundHandler());
  +	    ctx.addErrorPage( "404", "tomcat.notFoundHandler");
  +	}
       }
   
       // -------------------- implementation
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.100.2.3 +6 -0      jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.100.2.2
  retrieving revision 1.100.2.3
  diff -u -r1.100.2.2 -r1.100.2.3
  --- ContextManager.java	2000/07/25 21:00:24	1.100.2.2
  +++ ContextManager.java	2000/08/14 23:55:36	1.100.2.3
  @@ -942,6 +942,12 @@
   	errorPath = ctx.getErrorPage( code );
   	if( errorPath != null ) {
   	    errorServlet=getHandlerForPath( ctx, errorPath );
  +
  +	    // Make sure Jsps will work
  +	    req.setAttribute( "javax.servlet.include.request_uri",
  +				  ctx.getPath()  + "/" + errorPath );
  +	    req.setAttribute( "javax.servlet.include.servlet_path", errorPath );
  +
   	}
   	if( debug>0 )
   	    ctx.log( "Handler " + errorServlet + " " + errorPath);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.12.2.2  +9 -4      jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java
  
  Index: AccessInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/AccessInterceptor.java,v
  retrieving revision 1.12.2.1
  retrieving revision 1.12.2.2
  diff -u -r1.12.2.1 -r1.12.2.2
  --- AccessInterceptor.java	2000/07/26 01:29:25	1.12.2.1
  +++ AccessInterceptor.java	2000/08/14 23:55:37	1.12.2.2
  @@ -134,8 +134,11 @@
   	    if(page==null || errorPage==null) {
   		ctx.log( "Form login without form pages, defaulting to basic "
   			 + page + " " + errorPage);
  -		ctx.addServlet( new BasicAuthHandler());
  -		ctx.addErrorPage( "401", "tomcat.basicAuthHandler");
  +		// if the user specifies a 401 page do nothing
  +		if( null==ctx.getErrorPage( "401" )) {
  +		    ctx.addServlet( new BasicAuthHandler());
  +		    ctx.addErrorPage( "401", "tomcat.basicAuthHandler");
  +		}
   		return;
   	    }
   
  @@ -192,8 +195,10 @@
   			 " to tomcat.formSecurityCheck for " +
   			 page);
   	} else if( "BASIC".equals( login_type )) {
  -	    ctx.addServlet( new BasicAuthHandler());
  -	    ctx.addErrorPage( "401", "tomcat.basicAuthHandler");
  +	    if( null==ctx.getErrorPage( "401" )) {
  +		ctx.addServlet( new BasicAuthHandler());
  +		ctx.addErrorPage( "401", "tomcat.basicAuthHandler");
  +	    }
   	} else {
   	    // if unknown, leave the normal 404 error handler to deal
   	    // with unauthorized access.
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.16.2.1  +6 -4      jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpRequestAdapter.java
  
  Index: HttpRequestAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpRequestAdapter.java,v
  retrieving revision 1.16
  retrieving revision 1.16.2.1
  diff -u -r1.16 -r1.16.2.1
  --- HttpRequestAdapter.java	2000/05/30 06:16:51	1.16
  +++ HttpRequestAdapter.java	2000/08/14 23:55:37	1.16.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpRequestAdapter.java,v 1.16 2000/05/30 06:16:51 costin Exp $
  - * $Revision: 1.16 $
  - * $Date: 2000/05/30 06:16:51 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpRequestAdapter.java,v 1.16.2.1 2000/08/14 23:55:37 costin Exp $
  + * $Revision: 1.16.2.1 $
  + * $Date: 2000/08/14 23:55:37 $
    *
    * ====================================================================
    *
  @@ -73,6 +73,8 @@
   import javax.servlet.http.*;
   
   public class HttpRequestAdapter extends RequestImpl {
  +    private static StringManager sm1=
  +	StringManager.getManager("org.apache.tomcat.util");
       private Socket socket;
       private boolean moreRequests = false;
       RecycleBufferedInputStream sin;
  @@ -171,7 +173,7 @@
   
   		    if (len == -1) {
                           String msg =
  -                            sm.getString("mimeHeader.connection.ioe");
  +                            sm1.getString("mimeHeader.connection.ioe");
   
   			throw new IOException (msg);
   		    }