tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gl...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java
Date Sun, 04 Feb 2001 00:49:57 GMT
glenn       01/02/03 16:49:57

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationDispatcher.java
  Log:
  Implement SecurityManager
  
  Revision  Changes    Path
  1.12      +42 -26    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ApplicationDispatcher.java	2001/01/23 22:05:52	1.11
  +++ ApplicationDispatcher.java	2001/02/04 00:49:56	1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
1.11 2001/01/23 22:05:52 glenn Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/01/23 22:05:52 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
1.12 2001/02/04 00:49:56 glenn Exp $
  + * $Revision: 1.12 $
  + * $Date: 2001/02/04 00:49:56 $
    *
    * ====================================================================
    *
  @@ -67,6 +67,7 @@
   import java.io.IOException;
   import java.io.PrintWriter;
   import java.security.AccessController;
  +import java.security.PrivilegedExceptionAction;
   import java.security.PrivilegedActionException;
   import javax.servlet.RequestDispatcher;
   import javax.servlet.Servlet;
  @@ -96,13 +97,45 @@
    * <code>javax.servlet.ServletResponseWrapper</code>.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.11 $ $Date: 2001/01/23 22:05:52 $
  + * @version $Revision: 1.12 $ $Date: 2001/02/04 00:49:56 $
    */
   
   final class ApplicationDispatcher
       implements RequestDispatcher {
   
   
  +    protected class PrivilegedForward implements PrivilegedExceptionAction {
  +        private ServletRequest request;
  +        private ServletResponse response;
  +
  +        PrivilegedForward(ServletRequest request, ServletResponse response)
  +        {   
  +	    this.request = request;
  +	    this.response = response;
  +        }   
  +            
  +        public Object run() throws ServletException, IOException {
  +	    doForward(request,response);
  +	    return null;
  +        }   
  +    }
  +
  +    protected class PrivilegedInclude implements PrivilegedExceptionAction {
  +        private ServletRequest request;
  +        private ServletResponse response;
  +
  +        PrivilegedInclude(ServletRequest request, ServletResponse response)
  +        {  
  +            this.request = request;
  +            this.response = response;
  +        }
  +        
  +        public Object run() throws ServletException, IOException {
  +            doInclude(request,response);
  +            return null;
  +        }              
  +    }
  +
       // ----------------------------------------------------------- Constructors
   
   
  @@ -214,18 +247,9 @@
           throws ServletException, IOException
       {
           if( System.getSecurityManager() != null ) {
  -            final ServletRequest req = request;
  -            final ServletResponse res = response;
               try {
  -                java.security.AccessController.doPrivileged(
  -                    new java.security.PrivilegedExceptionAction()
  -                    {
  -                        public Object run() throws ServletException, IOException {
  -                            doForward(req,res);
  -                            return null;
  -                        }
  -                    }
  -                );
  +		PrivilegedForward dp = new PrivilegedForward(request,response);
  +                AccessController.doPrivileged(dp);
               } catch( PrivilegedActionException pe) {
                   Exception e = pe.getException();
                   if( e.getClass().getName().equals("javax.servlet.ServletException") )
  @@ -366,20 +390,12 @@
           throws ServletException, IOException
       {
           if( System.getSecurityManager() != null ) {
  -            final ServletRequest req = request;
  -            final ServletResponse res = response;
               try {
  -                java.security.AccessController.doPrivileged(
  -                    new java.security.PrivilegedExceptionAction()
  -                    {
  -                        public Object run() throws ServletException, IOException {
  -                            doInclude(req,res);
  -                            return null;       
  -                        }               
  -                    }       
  -                );      
  +                PrivilegedInclude dp = new PrivilegedInclude(request,response);
  +                AccessController.doPrivileged(dp);
               } catch( PrivilegedActionException pe) {
                   Exception e = pe.getException();
  +		pe.printStackTrace();
                   if( e.getClass().getName().equals("javax.servlet.ServletException") )
                       throw (ServletException)e;
                   throw (IOException)e;
  
  
  

Mime
View raw message