cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java ApplicationHttpRequest.java

2005-04-10 Thread markt
markt   2005/04/10 11:22:56

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
ApplicationHttpRequest.java
  Log:
  Fix bug 22013. RequestDispatcher.forward doesn't work with a relative path on
  a forwarded request
  - Patch supplied by Cedric Benazech
  
  Revision  ChangesPath
  1.33  +3 -2  
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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ApplicationDispatcher.java26 Aug 2004 21:31:21 -  1.32
  +++ ApplicationDispatcher.java10 Apr 2005 18:22:56 -  1.33
  @@ -861,7 +861,8 @@
   if ((current instanceof ApplicationHttpRequest) ||
   (current instanceof HttpRequest) ||
   (current instanceof HttpServletRequest))
  -wrapper = new ApplicationHttpRequest((HttpServletRequest) 
current);
  +wrapper = new ApplicationHttpRequest(
  +(HttpServletRequest) current, context);
   else
   wrapper = new ApplicationRequest(current);
   if (previous == null)
  
  
  
  1.16  +51 -8 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java
  
  Index: ApplicationHttpRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ApplicationHttpRequest.java   15 Jan 2005 20:27:05 -  1.15
  +++ ApplicationHttpRequest.java   10 Apr 2005 18:22:56 -  1.16
  @@ -23,8 +23,12 @@
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  +
  +import javax.servlet.RequestDispatcher;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletRequestWrapper;
  +
  +import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
   import org.apache.catalina.util.Enumerator;
   import org.apache.catalina.util.RequestUtil;
  @@ -49,7 +53,6 @@
   
   class ApplicationHttpRequest extends HttpServletRequestWrapper {
   
  -
   // --- Static 
Variables
   
   
  @@ -62,24 +65,28 @@
 Globals.QUERY_STRING_ATTR };
   
   
  -// --- 
Constructors
   
  +// --- 
Constructors
   
   /**
  - * Construct a new wrapped request around the specified servlet request.
  + * Construct a new wrapped request around the specified servlet request 
in
  + * the specified context.
*
* @param request The servlet request being wrapped
  + * @param context The Context this ApplicationHttpRequest is associated 
with
*/
  -public ApplicationHttpRequest(HttpServletRequest request) {
  -
  +public ApplicationHttpRequest(HttpServletRequest request, Context 
context) {
   super(request);
   setRequest(request);
  -
  +this.context = context;
   }
   
  -
   // - Instance 
Variables
   
  +/**
  + * The Context this ApplicationHttpRequest is associated with.
  + */
  +protected Context context;
   
   /**
* The request attributes for this request.  This is initialized from the
  @@ -377,6 +384,42 @@
   
   
   /**
  + * Return a RequestDispatcher that wraps the resource at the specified
  + * path, which may be interpreted as relative to the current request 
path.
  + *
  + * @param path Path of the resource to be wrapped
  + */
  +public RequestDispatcher getRequestDispatcher(String path) {
  +
  +if (context == null)
  +return (null);
  +
  +// If the path is already context-relative, just pass it through
  +if (path == null)
  +return (null);
  +else if (path.startsWith(/))
  +return (context.getServletContext().getRequestDispatcher(path));
  +
  +// Convert a request-relative path to a context-relative one
  +String servletPath = (String) 
getAttribute(Globals.SERVLET_PATH_ATTR);
  +if (servletPath == null)
  +servletPath = getServletPath();
  +
  +int pos = servletPath.lastIndexOf('/');
  +String relative = null;
  +if (pos = 0) {
  +relative = RequestUtil.normalize
  +(servletPath.substring(0, pos + 1) + path);
  +   

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2004-04-24 Thread markt
markt   2004/04/24 08:10:26

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  - Fix bug19801. Request dispatcher does not set empty javax.servlet.include request 
attributes
  on nested includes.
   Based on a patch suggested by Matthias Ernst
  - Removed unused imports identified by Eclipse.
  
  Revision  ChangesPath
  1.31  +12 -22
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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ApplicationDispatcher.java9 Jun 2002 05:45:04 -   1.30
  +++ ApplicationDispatcher.java24 Apr 2004 15:10:26 -  1.31
  @@ -78,11 +78,8 @@
   import javax.servlet.ServletResponse;
   import javax.servlet.ServletResponseWrapper;
   import javax.servlet.UnavailableException;
  -import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
  -import javax.servlet.http.HttpServletRequestWrapper;
   import javax.servlet.http.HttpServletResponse;
  -import javax.servlet.http.HttpServletResponseWrapper;
   import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
   import org.apache.catalina.HttpRequest;
  @@ -320,7 +317,7 @@
*/
   public String getInfo() {
   
  -return (this.info);
  +return (info);
   
   }
   
  @@ -554,21 +551,14 @@
   sb.append(servletPath);
   if (pathInfo != null)
   sb.append(pathInfo);
  -if (sb.length()  0)
  -wrequest.setAttribute(Globals.REQUEST_URI_ATTR,
  -  sb.toString());
  -if (contextPath != null)
  -wrequest.setAttribute(Globals.CONTEXT_PATH_ATTR,
  -  contextPath);
  -if (servletPath != null)
  -wrequest.setAttribute(Globals.SERVLET_PATH_ATTR,
  -  servletPath);
  -if (pathInfo != null)
  -wrequest.setAttribute(Globals.PATH_INFO_ATTR,
  -  pathInfo);
  +
  +wrequest.setAttribute(Globals.REQUEST_URI_ATTR, sb.toString());
  +wrequest.setAttribute(Globals.CONTEXT_PATH_ATTR, contextPath);
  +wrequest.setAttribute(Globals.SERVLET_PATH_ATTR, servletPath);
  +wrequest.setAttribute(Globals.PATH_INFO_ATTR, pathInfo);
  +wrequest.setAttribute(Globals.QUERY_STRING_ATTR, queryString);
  +
   if (queryString != null) {
  -wrequest.setAttribute(Globals.QUERY_STRING_ATTR,
  -  queryString);
   wrequest.mergeParameters(queryString);
   }
   // invoke(wrequest, wresponse);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2002-06-08 Thread remm

remm2002/06/08 22:45:04

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  - Apply patch for bug 9722, which seems reasonable. According to my testing,
it does not break anything.
  
  Revision  ChangesPath
  1.30  +9 -6  
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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ApplicationDispatcher.java11 Dec 2001 08:26:16 -  1.29
  +++ ApplicationDispatcher.java9 Jun 2002 05:45:04 -   1.30
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.29 2001/12/11 08:26:16 remm Exp $
  - * $Revision: 1.29 $
  - * $Date: 2001/12/11 08:26:16 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.30 2002/06/09 05:45:04 remm Exp $
  + * $Revision: 1.30 $
  + * $Date: 2002/06/09 05:45:04 $
*
* 
*
  @@ -92,6 +92,7 @@
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Wrapper;
  +import org.apache.catalina.connector.RequestFacade;
   import org.apache.catalina.connector.ResponseFacade;
   import org.apache.catalina.core.StandardWrapper;
   import org.apache.catalina.util.InstanceSupport;
  @@ -109,7 +110,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.29 $ $Date: 2001/12/11 08:26:16 $
  + * @version $Revision: 1.30 $ $Date: 2002/06/09 05:45:04 $
*/
   
   final class ApplicationDispatcher
  @@ -826,7 +827,8 @@
   while (current != null) {
   
   // If we run into the container request we are done
  -if (current instanceof Request)
  +if ((current instanceof Request)
  +|| (current instanceof RequestFacade))
   break;
   
   // Remove the current request if it is our wrapper
  @@ -862,7 +864,8 @@
   while (current != null) {
   
   // If we run into the container response we are done
  -if (current instanceof Response)
  +if ((current instanceof Response) 
  +|| (current instanceof ResponseFacade))
   break;
   
   // Remove the current response if it is our wrapper
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-12-11 Thread remm

remm01/12/11 00:11:09

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  - Make code more robust. Fixes a tester failure.
  
  Revision  ChangesPath
  1.28  +5 -5  
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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ApplicationDispatcher.java2001/10/31 17:39:34 1.27
  +++ ApplicationDispatcher.java2001/12/11 08:11:09 1.28
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.27 2001/10/31 17:39:34 remm Exp $
  - * $Revision: 1.27 $
  - * $Date: 2001/10/31 17:39:34 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.28 2001/12/11 08:11:09 remm Exp $
  + * $Revision: 1.28 $
  + * $Date: 2001/12/11 08:11:09 $
*
* 
*
  @@ -109,7 +109,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.27 $ $Date: 2001/10/31 17:39:34 $
  + * @version $Revision: 1.28 $ $Date: 2001/12/11 08:11:09 $
*/
   
   final class ApplicationDispatcher
  @@ -441,8 +441,8 @@
   ((ResponseFacade) response).finish();
   } else {
   // Close anyway
  -response.flushBuffer();
   try {
  +response.flushBuffer();
   PrintWriter writer = response.getWriter();
   writer.flush();
   writer.close();
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-12-11 Thread remm

remm01/12/11 00:26:17

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  - Modify a bit latest patch, since here the flush should be in its own try/catch.
  
  Revision  ChangesPath
  1.29  +8 -4  
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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ApplicationDispatcher.java2001/12/11 08:11:09 1.28
  +++ ApplicationDispatcher.java2001/12/11 08:26:16 1.29
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.28 2001/12/11 08:11:09 remm Exp $
  - * $Revision: 1.28 $
  - * $Date: 2001/12/11 08:11:09 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.29 2001/12/11 08:26:16 remm Exp $
  + * $Revision: 1.29 $
  + * $Date: 2001/12/11 08:26:16 $
*
* 
*
  @@ -109,7 +109,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.28 $ $Date: 2001/12/11 08:11:09 $
  + * @version $Revision: 1.29 $ $Date: 2001/12/11 08:26:16 $
*/
   
   final class ApplicationDispatcher
  @@ -443,6 +443,10 @@
   // Close anyway
   try {
   response.flushBuffer();
  +} catch (IllegalStateException f) {
  +;
  +}
  +try {
   PrintWriter writer = response.getWriter();
   writer.flush();
   writer.close();
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-11-02 Thread remm

remm01/11/02 18:10:56

  Modified:catalina/src/share/org/apache/catalina/core Tag:
tomcat_40_branch ApplicationDispatcher.java
  Log:
  - Port fix for bug 4501.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.25.2.2  +6 -6  
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.25.2.1
  retrieving revision 1.25.2.2
  diff -u -r1.25.2.1 -r1.25.2.2
  --- ApplicationDispatcher.java2001/10/04 19:27:58 1.25.2.1
  +++ ApplicationDispatcher.java2001/11/03 02:10:56 1.25.2.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.25.2.1 2001/10/04 19:27:58 remm Exp $
  - * $Revision: 1.25.2.1 $
  - * $Date: 2001/10/04 19:27:58 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.25.2.2 2001/11/03 02:10:56 remm Exp $
  + * $Revision: 1.25.2.2 $
  + * $Date: 2001/11/03 02:10:56 $
*
* 
*
  @@ -109,7 +109,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.25.2.1 $ $Date: 2001/10/04 19:27:58 $
  + * @version $Revision: 1.25.2.2 $ $Date: 2001/11/03 02:10:56 $
*/
   
   final class ApplicationDispatcher
  @@ -347,7 +347,7 @@
   AccessController.doPrivileged(dp);
   } catch( PrivilegedActionException pe) {
   Exception e = pe.getException();
  -if( e.getClass().getName().equals(javax.servlet.ServletException) 
)
  +if (e instanceof ServletException)
   throw (ServletException)e;
   throw (IOException)e;
   }
  @@ -485,7 +485,7 @@
   } catch( PrivilegedActionException pe) {
   Exception e = pe.getException();
   pe.printStackTrace();
  -if( e.getClass().getName().equals(javax.servlet.ServletException) 
)
  +if (e instanceof ServletException)
   throw (ServletException)e;
   throw (IOException)e;
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-10-31 Thread remm

remm01/10/31 09:39:34

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  - Fix for 4501. I don't see any problems which would be caused by using instanceof.
Please correct me if I'm wrong.
Patch submitted by Yan Pujante (yan.pujante at reuters.com).
  
  Revision  ChangesPath
  1.27  +14 -14
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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ApplicationDispatcher.java2001/09/28 16:57:51 1.26
  +++ ApplicationDispatcher.java2001/10/31 17:39:34 1.27
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.26 2001/09/28 16:57:51 remm Exp $
  - * $Revision: 1.26 $
  - * $Date: 2001/09/28 16:57:51 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.27 2001/10/31 17:39:34 remm Exp $
  + * $Revision: 1.27 $
  + * $Date: 2001/10/31 17:39:34 $
*
* 
*
  @@ -109,7 +109,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.26 $ $Date: 2001/09/28 16:57:51 $
  + * @version $Revision: 1.27 $ $Date: 2001/10/31 17:39:34 $
*/
   
   final class ApplicationDispatcher
  @@ -341,15 +341,15 @@
   public void forward(ServletRequest request, ServletResponse response)
   throws ServletException, IOException
   {
  -if( System.getSecurityManager() != null ) {
  +if (System.getSecurityManager() != null) {
   try {
   PrivilegedForward dp = new PrivilegedForward(request,response);
   AccessController.doPrivileged(dp);
  -} catch( PrivilegedActionException pe) {
  +} catch (PrivilegedActionException pe) {
   Exception e = pe.getException();
  -if( e.getClass().getName().equals(javax.servlet.ServletException) 
)
  -throw (ServletException)e;
  -throw (IOException)e;
  +if (e instanceof ServletException)
  +throw (ServletException) e;
  +throw (IOException) e;
   }
   } else {
   doForward(request,response);
  @@ -478,16 +478,16 @@
   public void include(ServletRequest request, ServletResponse response)
   throws ServletException, IOException
   {
  -if( System.getSecurityManager() != null ) {
  +if (System.getSecurityManager() != null) {
   try {
   PrivilegedInclude dp = new PrivilegedInclude(request,response);
   AccessController.doPrivileged(dp);
  -} catch( PrivilegedActionException pe) {
  +} catch (PrivilegedActionException pe) {
   Exception e = pe.getException();
   pe.printStackTrace();
  -if( e.getClass().getName().equals(javax.servlet.ServletException) 
)
  -throw (ServletException)e;
  -throw (IOException)e;
  +if (e instanceof ServletException)
  +throw (ServletException) e;
  +throw (IOException) e;
   }
   } else {
   doInclude(request,response);
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-08-07 Thread remm

remm01/08/07 17:32:02

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  - Cross contexts include and forwards were broken because the context
class loader wasn't appropriately set. Now, check if the current context class
loader is the same as the one in the Catalina Context's loader. If it's not, the
old context class loader value is saved, the Catalina Context class loader is
set as the context class loader, and after the wrapper has been allocated
and invoked, the old context class loader value is restored.
Bug reported by Serge Huber shuber at xo3.com.
  
  Revision  ChangesPath
  1.25  +20 -5 
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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ApplicationDispatcher.java2001/08/01 03:04:04 1.24
  +++ ApplicationDispatcher.java2001/08/08 00:31:54 1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.24 2001/08/01 03:04:04 craigmcc Exp $
  - * $Revision: 1.24 $
  - * $Date: 2001/08/01 03:04:04 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.25 2001/08/08 00:31:54 remm Exp $
  + * $Revision: 1.25 $
  + * $Date: 2001/08/08 00:31:54 $
*
* 
*
  @@ -108,7 +108,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.24 $ $Date: 2001/08/01 03:04:04 $
  + * @version $Revision: 1.25 $ $Date: 2001/08/08 00:31:54 $
*/
   
   final class ApplicationDispatcher
  @@ -337,7 +337,6 @@
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
  -
   public void forward(ServletRequest request, ServletResponse response)
   throws ServletException, IOException
   {
  @@ -591,6 +590,18 @@
   private void invoke(ServletRequest request, ServletResponse response)
   throws IOException, ServletException {
   
  +// Checking to see if the context classloader is the current context
  +// classloader. If it's not, we're saving it, and setting the context
  +// classloader to the Context classloader
  +ClassLoader oldCCL = Thread.currentThread().getContextClassLoader();
  +ClassLoader contextClassLoader = context.getLoader().getClassLoader();
  +
  +if (oldCCL != contextClassLoader) {
  +Thread.currentThread().setContextClassLoader(contextClassLoader);
  +} else {
  +oldCCL = null;
  +}
  +
   // Initialize local variables we may need
   HttpServletRequest hrequest = null;
   if (request instanceof HttpServletRequest)
  @@ -716,6 +727,10 @@
   (sm.getString(applicationDispatcher.deallocateException,
 wrapper.getName()), e);
   }
  +
  +// Reset the old context class loader
  +if (oldCCL != null)
  +Thread.currentThread().setContextClassLoader(oldCCL);
   
   // Rethrow an exception if one was thrown by the invoked servlet
   if (ioException != null)
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java ApplicationDispatcherContext.java

2001-07-16 Thread craigmcc

craigmcc01/07/16 15:24:13

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Removed: catalina/src/share/org/apache/catalina/core
ApplicationDispatcherContext.java
  Log:
  Modify the way that request dispatching is performed.
  
  Previously, Catalina would create request and/or response wrappers around
  the application-provided request and response objects.  However, this
  violated the application assumption that a wrapper instance created by the
  calling servlet would be the same one seen by a called servlet.
  
  Now, Catalina creates wrappers as before; however they are *inserted* into
  the request and response wrapper chains, just above the container-provided
  request and response implementation objects (or above previously inserted
  wrappers in the case of nested request dispatchers).
  
  Revision  ChangesPath
  1.20  +254 -22   
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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ApplicationDispatcher.java2001/07/13 00:51:44 1.19
  +++ ApplicationDispatcher.java2001/07/16 22:24:12 1.20
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.19 2001/07/13 00:51:44 craigmcc Exp $
  - * $Revision: 1.19 $
  - * $Date: 2001/07/13 00:51:44 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.20 2001/07/16 22:24:12 craigmcc Exp $
  + * $Revision: 1.20 $
  + * $Date: 2001/07/16 22:24:12 $
*
* 
*
  @@ -74,15 +74,22 @@
   import javax.servlet.ServletException;
   import javax.servlet.ServletOutputStream;
   import javax.servlet.ServletRequest;
  +import javax.servlet.ServletRequestWrapper;
   import javax.servlet.ServletResponse;
  +import javax.servlet.ServletResponseWrapper;
   import javax.servlet.UnavailableException;
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
  +import javax.servlet.http.HttpServletRequestWrapper;
   import javax.servlet.http.HttpServletResponse;
  +import javax.servlet.http.HttpServletResponseWrapper;
   import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
   import org.apache.catalina.HttpRequest;
  +import org.apache.catalina.HttpResponse;
   import org.apache.catalina.Logger;
  +import org.apache.catalina.Request;
  +import org.apache.catalina.Response;
   import org.apache.catalina.Wrapper;
   import org.apache.catalina.util.StringManager;
   
  @@ -98,7 +105,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.19 $ $Date: 2001/07/13 00:51:44 $
  + * @version $Revision: 1.20 $ $Date: 2001/07/16 22:24:12 $
*/
   
   final class ApplicationDispatcher
  @@ -191,6 +198,18 @@
   
   
   /**
  + * The request specified by the dispatching application.
  + */
  +private ServletRequest appRequest = null;
  +
  +
  +/**
  + * The response specified by the dispatching application.
  + */
  +private ServletResponse appResponse = null;
  +
  +
  +/**
* The Context this RequestDispatcher is associated with.
*/
   private Context context = null;
  @@ -203,6 +222,12 @@
   
   
   /**
  + * Are we performing an include() instead of a forward()?
  + */
  +private boolean including = false;
  +
  +
  +/**
* Descriptive information about this implementation.
*/
   private static final String info =
  @@ -216,6 +241,18 @@
   
   
   /**
  + * The outermost request that will be passed on to the invoked servlet.
  + */
  +private ServletRequest outerRequest = null;
  +
  +
  +/**
  + * The outermost response that will be passed on to the invoked servlet.
  + */
  +private ServletResponse outerResponse = null;
  +
  +
  +/**
* The extra path information for this RequestDispatcher.
*/
   private String pathInfo = null;
  @@ -247,6 +284,18 @@
   private Wrapper wrapper = null;
   
   
  +/**
  + * The request wrapper we have created and installed (if any).
  + */
  +private ServletRequest wrapRequest = null;
  +
  +
  +/**
  + * The response wrapper we have created and installed (if any).
  + */
  +private ServletResponse wrapResponse = null;
  +
  +
   // - Properties
   
   
  @@ -296,6 +345,7 @@
   

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-07-11 Thread craigmcc

craigmcc01/07/11 19:42:05

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Log a few exceptional conditions in addition to throwing the exceptions
  required by the spec.
  
  Revision  ChangesPath
  1.18  +15 -6 
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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ApplicationDispatcher.java2001/05/23 21:53:01 1.17
  +++ ApplicationDispatcher.java2001/07/12 02:42:02 1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.17 2001/05/23 21:53:01 craigmcc Exp $
  - * $Revision: 1.17 $
  - * $Date: 2001/05/23 21:53:01 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.18 2001/07/12 02:42:02 craigmcc Exp $
  + * $Revision: 1.18 $
  + * $Date: 2001/07/12 02:42:02 $
*
* 
*
  @@ -98,7 +98,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.17 $ $Date: 2001/05/23 21:53:01 $
  + * @version $Revision: 1.18 $ $Date: 2001/07/12 02:42:02 $
*/
   
   final class ApplicationDispatcher
  @@ -297,10 +297,19 @@
   throws ServletException, IOException
   {
// Reset any output that has been buffered, but keep headers/cookies
  - if (response.isCommitted())
  +if (response.isCommitted()) {
  +if (debug = 1)
  +log(  Forward on committed response -- ISE);
throw new IllegalStateException
(sm.getString(applicationDispatcher.forward.ise));
  -response.resetBuffer();
  +}
  +try {
  +response.resetBuffer();
  +} catch (IllegalStateException e) {
  +if (debug = 1)
  +log(  Forward resetBuffer() returned ISE:  + e);
  +throw e;
  +}
   
// Identify the HTTP-specific request and response objects (if any)
HttpServletRequest hrequest = null;
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-05-23 Thread craigmcc

craigmcc01/05/23 14:53:02

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Change the way that the servlet's service() method is invoked to match the
  way this is done in ApplicationFilterChain when a top-level servlet is
  called.  This should avoid compiler complaints on
  Win2k/Forte2.0/JDK1.3.0_01.
  
  NOTE:  Researching this issue points out a small optimization that can
  take place in ApplicationFilterChain for SingleThreadModel servlets - see
  next patch.
  
  PR:  Patch #2 of the 8 Patches email on 23 May 2001
  Submitted by: Peter Costello [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.17  +10 -9 
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ApplicationDispatcher.java2001/05/12 04:56:54 1.16
  +++ ApplicationDispatcher.java2001/05/23 21:53:01 1.17
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.16 2001/05/12 04:56:54 craigmcc Exp $
  - * $Revision: 1.16 $
  - * $Date: 2001/05/12 04:56:54 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.17 2001/05/23 21:53:01 craigmcc Exp $
  + * $Revision: 1.17 $
  + * $Date: 2001/05/23 21:53:01 $
*
* 
*
  @@ -98,7 +98,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.16 $ $Date: 2001/05/12 04:56:54 $
  + * @version $Revision: 1.17 $ $Date: 2001/05/23 21:53:01 $
*/
   
   final class ApplicationDispatcher
  @@ -561,11 +561,12 @@
// Call the service() method for the allocated servlet instance
try {
if (servlet != null) {
  - if ((servlet instanceof HttpServlet) 
  - (hrequest != null)  (hresponse != null))
  - ((HttpServlet) servlet).service(hrequest, hresponse);
  - else
  - servlet.service(request, response);
  +if ((hrequest != null)  (hresponse != null)) {
  +servlet.service((HttpServletRequest) request,
  +(HttpServletResponse) response);
  +} else {
  +servlet.service(request, response);
  +}
}
} catch (IOException e) {
log(sm.getString(applicationDispatcher.serviceException,
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java ApplicationHttpRequest.java ApplicationHttpResponse.java

2001-05-11 Thread craigmcc

craigmcc01/05/11 21:56:55

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
ApplicationHttpRequest.java
ApplicationHttpResponse.java
  Log:
  Add an innocuous public method to each class for unit tests to validate
  that access is prevented.
  
  Revision  ChangesPath
  1.16  +24 -4 
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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ApplicationDispatcher.java2001/05/04 03:41:10 1.15
  +++ ApplicationDispatcher.java2001/05/12 04:56:54 1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.15 2001/05/04 03:41:10 craigmcc Exp $
  - * $Revision: 1.15 $
  - * $Date: 2001/05/04 03:41:10 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.16 2001/05/12 04:56:54 craigmcc Exp $
  + * $Revision: 1.16 $
  + * $Date: 2001/05/12 04:56:54 $
*
* 
*
  @@ -98,7 +98,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.15 $ $Date: 2001/05/04 03:41:10 $
  + * @version $Revision: 1.16 $ $Date: 2001/05/12 04:56:54 $
*/
   
   final class ApplicationDispatcher
  @@ -203,6 +203,13 @@
   
   
   /**
  + * Descriptive information about this implementation.
  + */
  +private static final String info =
  +org.apache.catalina.core.ApplicationDispatcher/1.0;
  +
  +
  +/**
* The servlet name for a named dispatcher.
*/
   private String name = null;
  @@ -238,6 +245,19 @@
* or included.
*/
   private Wrapper wrapper = null;
  +
  +
  +// - Properties
  +
  +
  +/**
  + * Return the descriptive information about this implementation.
  + */
  +public String getInfo() {
  +
  +return (this.info);
  +
  +}
   
   
   // - Public Methods
  
  
  
  1.6   +21 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java
  
  Index: ApplicationHttpRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ApplicationHttpRequest.java   2001/05/02 20:44:19 1.5
  +++ ApplicationHttpRequest.java   2001/05/12 04:56:54 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java,v
 1.5 2001/05/02 20:44:19 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/05/02 20:44:19 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationHttpRequest.java,v
 1.6 2001/05/12 04:56:54 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/05/12 04:56:54 $
*
* 
*
  @@ -93,7 +93,7 @@
* keep these two classes in synchronization when making changes!
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/05/02 20:44:19 $
  + * @version $Revision: 1.6 $ $Date: 2001/05/12 04:56:54 $
*/
   
   class ApplicationHttpRequest extends HttpServletRequestWrapper {
  @@ -144,6 +144,13 @@
   
   
   /**
  + * Descriptive information about this implementation.
  + */
  +protected static final String info =
  +org.apache.catalina.core.ApplicationHttpRequest/1.0;
  +
  +
  +/**
* The request parameters for this request.  This is initialized from the
* wrapped request, but updates are allowed.
*/
  @@ -385,6 +392,16 @@
   
   //  Package Methods
   
  +
  +
  +/**
  + * Return descriptive information about this implementation.
  + */
  +public String getInfo() {
  +
  +return (this.info);
  +
  +}
   
   
   /**
  
  
  
  1.2   +21 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationHttpResponse.java
  
  Index: ApplicationHttpResponse.java
  ===
  RCS file: 

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-05-03 Thread craigmcc

craigmcc01/05/03 16:04:17

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Update handling or a servlet that is included or forwarded to via a
  RequestDispatcher, and uses a jsp-file declaration to map the definition
  to a JSP page.
  
  Revision  ChangesPath
  1.14  +19 -7 
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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ApplicationDispatcher.java2001/02/06 02:39:43 1.13
  +++ ApplicationDispatcher.java2001/05/03 23:04:15 1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.13 2001/02/06 02:39:43 craigmcc Exp $
  - * $Revision: 1.13 $
  - * $Date: 2001/02/06 02:39:43 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.14 2001/05/03 23:04:15 craigmcc Exp $
  + * $Revision: 1.14 $
  + * $Date: 2001/05/03 23:04:15 $
*
* 
*
  @@ -81,6 +81,7 @@
   import javax.servlet.http.HttpServletResponse;
   import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
  +import org.apache.catalina.HttpRequest;
   import org.apache.catalina.Logger;
   import org.apache.catalina.Wrapper;
   import org.apache.catalina.util.StringManager;
  @@ -97,7 +98,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.13 $ $Date: 2001/02/06 02:39:43 $
  + * @version $Revision: 1.14 $ $Date: 2001/05/03 23:04:15 $
*/
   
   final class ApplicationDispatcher
  @@ -174,6 +175,15 @@
this.pathInfo + , queryString= + queryString +
   , name= + this.name);
   
  +// If this is a wrapper for a JSP page (jsp-file), tweak
  +// the request parameters appropriately
  +String jspFile = wrapper.getJspFile();
  +if (jspFile != null) {
  +if (debug = 1)
  +log(--servletPath= + jspFile);
  +this.servletPath = jspFile;
  +}
  +
   }
   
   
  @@ -189,7 +199,7 @@
   /**
* The debugging detail level for this component.
*/
  -private int debug = 0;
  +private int debug = 1;
   
   
   /**
  @@ -292,8 +302,8 @@
// Handle an HTTP named dispatcher forward
else if ((servletPath == null)  (pathInfo == null)) {
   
  - if (debug = 1)
  - log( Named Dispatcher Forward);
  +if (debug = 1)
  +log( Named Dispatcher Forward);
   invoke(request, response);
   
}
  @@ -411,6 +421,8 @@
ApplicationHttpRequest wrequest =
new ApplicationHttpRequest((HttpServletRequest) request);
   wrequest.setAttribute(Globals.NAMED_DISPATCHER_ATTR, name);
  +if (servletPath != null)
  +wrequest.setServletPath(servletPath);
   invoke(wrequest, wresponse);
   
}
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-05-03 Thread craigmcc

craigmcc01/05/03 20:41:10

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Reset debugging detail level.
  
  Revision  ChangesPath
  1.15  +5 -5  
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ApplicationDispatcher.java2001/05/03 23:04:15 1.14
  +++ ApplicationDispatcher.java2001/05/04 03:41:10 1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.14 2001/05/03 23:04:15 craigmcc Exp $
  - * $Revision: 1.14 $
  - * $Date: 2001/05/03 23:04:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.15 2001/05/04 03:41:10 craigmcc Exp $
  + * $Revision: 1.15 $
  + * $Date: 2001/05/04 03:41:10 $
*
* 
*
  @@ -98,7 +98,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.14 $ $Date: 2001/05/03 23:04:15 $
  + * @version $Revision: 1.15 $ $Date: 2001/05/04 03:41:10 $
*/
   
   final class ApplicationDispatcher
  @@ -199,7 +199,7 @@
   /**
* The debugging detail level for this component.
*/
  -private int debug = 1;
  +private int debug = 0;
   
   
   /**
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-02-03 Thread glenn

glenn   01/02/03 16:49:57

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  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.java2001/01/23 22:05:52 1.11
  +++ ApplicationDispatcher.java2001/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 @@
* codejavax.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( 

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-01-23 Thread glenn

glenn   01/01/23 14:05:55

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.11  +6 -6  
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ApplicationDispatcher.java2000/12/29 20:27:10 1.10
  +++ ApplicationDispatcher.java2001/01/23 22:05:52 1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.10 2000/12/29 20:27:10 glenn Exp $
  - * $Revision: 1.10 $
  - * $Date: 2000/12/29 20:27:10 $
  + * $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 $
*
* 
*
  @@ -64,10 +64,10 @@
   
   package org.apache.catalina.core;
   
  -import java.security.AccessController;
  -import java.security.PrivilegedActionException;
   import java.io.IOException;
   import java.io.PrintWriter;
  +import java.security.AccessController;
  +import java.security.PrivilegedActionException;
   import javax.servlet.RequestDispatcher;
   import javax.servlet.Servlet;
   import javax.servlet.ServletException;
  @@ -96,7 +96,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2000/12/29 20:27:10 $
  + * @version $Revision: 1.11 $ $Date: 2001/01/23 22:05:52 $
*/
   
   final class ApplicationDispatcher
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2000-12-29 Thread glenn

glenn   00/12/29 09:38:39

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  If SecurityManager being used, wrap forward() and include() with an 
AccessController.doPrivileged()
  
  Revision  ChangesPath
  1.9   +63 -8 
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ApplicationDispatcher.java2000/10/28 18:56:04 1.8
  +++ ApplicationDispatcher.java2000/12/29 17:38:39 1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.8 2000/10/28 18:56:04 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/10/28 18:56:04 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.9 2000/12/29 17:38:39 glenn Exp $
  + * $Revision: 1.9 $
  + * $Date: 2000/12/29 17:38:39 $
*
* 
*
  @@ -95,7 +95,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2000/10/28 18:56:04 $
  + * @version $Revision: 1.9 $ $Date: 2000/12/29 17:38:39 $
*/
   
   final class ApplicationDispatcher
  @@ -208,9 +208,37 @@
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
  -public void forward(ServletRequest request, ServletResponse response)
  -throws IOException, ServletException {
   
  +public void forward(ServletRequest request, ServletResponse response)
  +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;
  +}
  +}
  +);
  +} catch( PrivilegedActionException pe) {
  +Exception e = pe.getException();
  +if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
  +throw (ServletException)e;
  +throw (IOException)e;
  +}
  +} else {
  +doForward(request,response);
  +}
  +}
  + 
  +private void doForward(ServletRequest request, ServletResponse response)
  +throws ServletException, IOException
  +{
// Reset any output that has been buffered, but keep headers/cookies
if (response.isCommitted())
throw new IllegalStateException
  @@ -334,8 +362,35 @@
* @exception ServletException if a servlet exception occurs
*/
   public void include(ServletRequest request, ServletResponse response)
  -throws IOException, ServletException {
  -
  +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;   
  +}   
  +}   
  +);  
  +} catch( PrivilegedActionException pe) {
  +Exception e = pe.getException();
  +if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
  +throw (ServletException)e;
  +throw (IOException)e;
  +}
  +} else {
  +doInclude(request,response);
  +}
  +}
  + 
  +private void doInclude(ServletRequest request, ServletResponse response)
  +throws ServletException, IOException
  +{
// Create a wrapped response to use for this request
ServletResponse wresponse = null;
if (response instanceof HttpServletResponse) 

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2000-12-29 Thread glenn

glenn   00/12/29 12:27:11

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Fixed build, forgot to add some imports
  
  Revision  ChangesPath
  1.10  +6 -5  
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ApplicationDispatcher.java2000/12/29 17:38:39 1.9
  +++ ApplicationDispatcher.java2000/12/29 20:27:10 1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.9 2000/12/29 17:38:39 glenn Exp $
  - * $Revision: 1.9 $
  - * $Date: 2000/12/29 17:38:39 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.10 2000/12/29 20:27:10 glenn Exp $
  + * $Revision: 1.10 $
  + * $Date: 2000/12/29 20:27:10 $
*
* 
*
  @@ -64,7 +64,8 @@
   
   package org.apache.catalina.core;
   
  -
  +import java.security.AccessController;
  +import java.security.PrivilegedActionException;
   import java.io.IOException;
   import java.io.PrintWriter;
   import javax.servlet.RequestDispatcher;
  @@ -95,7 +96,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.9 $ $Date: 2000/12/29 17:38:39 $
  + * @version $Revision: 1.10 $ $Date: 2000/12/29 20:27:10 $
*/
   
   final class ApplicationDispatcher
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]