tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationDispatcher.java StandardContext.java
Date Wed, 21 May 2003 17:49:04 GMT
remm        2003/05/21 10:49:04

  Modified:    catalina/src/share/org/apache/catalina/core
                        ApplicationContext.java ApplicationDispatcher.java
                        StandardContext.java
  Log:
  - Remove the mapping hack for context mapping.
  - Pass the request URI as a parameter, as this avoids rebuilding it.
  
  Revision  Changes    Path
  1.12      +9 -7      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ApplicationContext.java	19 May 2003 21:54:07 -0000	1.11
  +++ ApplicationContext.java	21 May 2003 17:49:03 -0000	1.12
  @@ -409,7 +409,7 @@
           
           ApplicationDispatcher dispatcher;
           dispatcher =
  -              new ApplicationDispatcher(wrapper, null, null, null, name);
  +              new ApplicationDispatcher(wrapper, null, null, null, null, name);
           
           return ((RequestDispatcher) dispatcher);
   
  @@ -481,8 +481,9 @@
           }
   
           // Map the URI
  +        CharChunk uriCC = uriMB.getCharChunk();
           try {
  -            CharChunk uriCC = uriMB.getCharChunk();
  +            uriCC.append(context.getPath(), 0, context.getPath().length());
               uriCC.append(path, 0, pos);
               context.getMapper().map(uriMB, mappingData);
               if (mappingData.wrapper == null) {
  @@ -496,7 +497,8 @@
   
           // Construct a RequestDispatcher to process this request
           return (RequestDispatcher) new ApplicationDispatcher
  -            ((Wrapper) mappingData.wrapper, mappingData.wrapperPath.toString(),
  +            ((Wrapper) mappingData.wrapper, uriCC.toString(),
  +             mappingData.wrapperPath.toString(),
                mappingData.pathInfo.toString(), queryString, null);
   
       }
  
  
  
  1.17      +23 -17    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/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.java	17 Apr 2003 15:31:45 -0000	1.16
  +++ ApplicationDispatcher.java	21 May 2003 17:49:03 -0000	1.17
  @@ -162,6 +162,7 @@
        *
        * @param wrapper The Wrapper associated with the resource that will
        *  be forwarded to or included (required)
  +     * @param requestURI The request URI to this resource (if any)
        * @param servletPath The revised servlet path to this resource (if any)
        * @param pathInfo The revised extra path information to this resource
        *  (if any)
  @@ -171,7 +172,7 @@
        *  else <code>null</code>
        */
       public ApplicationDispatcher
  -        (Wrapper wrapper, String servletPath,
  +        (Wrapper wrapper, String requestURI, String servletPath,
            String pathInfo, String queryString, String name) {
   
           super();
  @@ -179,6 +180,7 @@
           // Save all of our configuration parameters
           this.wrapper = wrapper;
           this.context = (Context) wrapper.getParent();
  +        this.requestURI = requestURI;
           this.servletPath = servletPath;
           this.origServletPath = servletPath;
           this.pathInfo = pathInfo;
  @@ -278,6 +280,11 @@
   
   
       /**
  +     * The request URI for this RequestDispatcher.
  +     */
  +    private String requestURI = null;
  +
  +    /**
        * The servlet path for this RequestDispatcher.
        */
       private String servletPath = null;
  @@ -420,16 +427,18 @@
   
               ApplicationHttpRequest wrequest =
                   (ApplicationHttpRequest) wrapRequest();
  -            StringBuffer sb = new StringBuffer();
               String contextPath = context.getPath();
  +            /*
  +            StringBuffer sb = new StringBuffer();
               if (contextPath != null)
                   sb.append(contextPath);
               if (servletPath != null)
                   sb.append(servletPath);
               if (pathInfo != null)
                   sb.append(pathInfo);
  +            */
               wrequest.setContextPath(contextPath);
  -            wrequest.setRequestURI(sb.toString());
  +            wrequest.setRequestURI(requestURI);
               wrequest.setServletPath(servletPath);
               wrequest.setPathInfo(pathInfo);
           
  @@ -464,23 +473,17 @@
               // Servlet SRV.6.2.2. The Resquest/Response may have been wrapped
               // and may no longer be instance of RequestFacade 
               if (log.isDebugEnabled()){
  -                log.debug( " The Response is vehiculed using a wrapper: " + response.getClass().getName()
);
  +                log.debug( " The Response is vehiculed using a wrapper: " 
  +                           + response.getClass().getName() );
               }
   
               // Close anyway
               try {
  -                response.flushBuffer();
  -            } catch (IllegalStateException f) {
  -                ;
  -            }
  -            try {
                   PrintWriter writer = response.getWriter();
  -                writer.flush();
                   writer.close();
               } catch (IllegalStateException e) {
                   try {
                       ServletOutputStream stream = response.getOutputStream();
  -                    stream.flush();
                       stream.close();
                   } catch (IllegalStateException f) {
                       ;
  @@ -612,8 +615,9 @@
   
               ApplicationHttpRequest wrequest =
                   (ApplicationHttpRequest) wrapRequest();
  -            StringBuffer sb = new StringBuffer();
               String contextPath = context.getPath();
  +            /*
  +            StringBuffer sb = new StringBuffer();
               if (contextPath != null)
                   sb.append(contextPath);
               if (servletPath != null)
  @@ -621,8 +625,10 @@
               if (pathInfo != null)
                   sb.append(pathInfo);
               if (sb.length() > 0)
  +            */
  +            if (requestURI != null)
                   wrequest.setAttribute(Globals.INCLUDE_REQUEST_URI_ATTR,
  -                                      sb.toString());
  +                                      requestURI);
               if (contextPath != null)
                   wrequest.setAttribute(Globals.INCLUDE_CONTEXT_PATH_ATTR,
                                         contextPath);
  
  
  
  1.56      +2 -2      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- StandardContext.java	20 May 2003 21:05:11 -0000	1.55
  +++ StandardContext.java	21 May 2003 17:49:03 -0000	1.56
  @@ -4045,7 +4045,7 @@
                       ((Lifecycle) resources).start();
   
                   // Initialize associated mapper
  -                mapper.setContext(welcomeFiles, resources);
  +                mapper.setContext(getPath(), welcomeFiles, resources);
   
                   // Start our child containers, if any
                   Container children[] = findChildren();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message