tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@hyperreal.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Constants.java Context.java RequestMapper.java
Date Mon, 01 Nov 1999 02:42:32 GMT
gonzo       99/10/31 18:42:30

  Modified:    src/share/org/apache/tomcat/core Tag: TOMCAT_J2EE_10F_102199
                        Constants.java Context.java RequestMapper.java
  Log:
  add "resolved servlet" attribute hook [javax.servlet.resolved] - j2ee
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +7 -3      jakarta-tomcat/src/share/org/apache/tomcat/core/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Constants.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- Constants.java	1999/10/28 01:04:18	1.2.2.1
  +++ Constants.java	1999/11/01 02:42:18	1.2.2.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Constants.java,v
1.2.2.1 1999/10/28 01:04:18 gonzo Exp $
  - * $Revision: 1.2.2.1 $
  - * $Date: 1999/10/28 01:04:18 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Constants.java,v
1.2.2.2 1999/11/01 02:42:18 gonzo Exp $
  + * $Revision: 1.2.2.2 $
  + * $Date: 1999/11/01 02:42:18 $
    *
    * ====================================================================
    *
  @@ -171,6 +171,8 @@
       }
   
       public static class JSP {
  +        public static final String NAME = "jsp";
  +
           public static class Directive {
               public static class Compile {
                   public static final String Name = "jsp_precompile";
  @@ -196,6 +198,8 @@
               "javax.servlet.error.exception_type";
           public static final String ERROR_MESSAGE =
               "javax.servlet.error.message";
  +        public static final String RESOLVED_SERVLET =
  +            "javax.servlet.resolved";
       }
   
       public static class Locale {
  
  
  
  1.5.2.4   +10 -3     jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.5.2.3
  retrieving revision 1.5.2.4
  diff -u -r1.5.2.3 -r1.5.2.4
  --- Context.java	1999/10/30 05:36:21	1.5.2.3
  +++ Context.java	1999/11/01 02:42:20	1.5.2.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v 1.5.2.3
1999/10/30 05:36:21 gonzo Exp $
  - * $Revision: 1.5.2.3 $
  - * $Date: 1999/10/30 05:36:21 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v 1.5.2.4
1999/11/01 02:42:20 gonzo Exp $
  + * $Revision: 1.5.2.4 $
  + * $Date: 1999/11/01 02:42:20 $
    *
    * ====================================================================
    *
  @@ -634,6 +634,13 @@
   	
   	request.setServletPath(result.getServletPath());
   	request.setPathInfo(result.getPathInfo());
  +
  +        if (result.getMappedPath() != null) {
  +            request.setAttribute(Constants.Attribute.RESOLVED_SERVLET,
  +                result.getMappedPath());
  +        } else {
  +            request.removeAttribute(Constants.Attribute.RESOLVED_SERVLET);
  +        }
   
   	result.getWrapper().handleRequest(request.getFacade(),
               response.getFacade());
  
  
  
  1.2.2.2   +79 -32    jakarta-tomcat/src/share/org/apache/tomcat/core/RequestMapper.java
  
  Index: RequestMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestMapper.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- RequestMapper.java	1999/10/22 02:20:14	1.2.2.1
  +++ RequestMapper.java	1999/11/01 02:42:23	1.2.2.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestMapper.java,v
1.2.2.1 1999/10/22 02:20:14 gonzo Exp $
  - * $Revision: 1.2.2.1 $
  - * $Date: 1999/10/22 02:20:14 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestMapper.java,v
1.2.2.2 1999/11/01 02:42:23 gonzo Exp $
  + * $Revision: 1.2.2.2 $
  + * $Date: 1999/11/01 02:42:23 $
    *
    * ====================================================================
    *
  @@ -80,6 +80,7 @@
       private String servletPath = null;
       private String mapPath = null;
       private String pathInfo = null;
  +    private String resourceName = null;
   
       RequestMapper() {
       }
  @@ -101,9 +102,11 @@
   	ServletWrapper wrapper = getMatch(path);
   
   	if (wrapper != null) {
  -	    lookupResult = new LookupResult(wrapper,
  -	        this.servletPath, this.mapPath, this.pathInfo);
  -	}
  +            this.mapPath = getMapPath(wrapper);
  +
  +            lookupResult = new LookupResult(wrapper,
  +                this.servletPath, this.mapPath, this.pathInfo);
  +        }
   
   	return lookupResult;
       }
  @@ -129,33 +132,8 @@
   
   	// lookup real servlet if what we're actually
   	// dealing with a jsp file
  -
  -	if (wrapper != null) {
  -	    String servletPath = this.servletPath;
  -	    String pathInfo = this.pathInfo;
  -	    boolean stillSearching = true;
  -	    int counter = 0;
  -
  -            while (stillSearching) {
  -                if (wrapper != null &&
  -                    wrapper.getPath() != null &&
  -		    wrapper.getServletClass() == null) {
  -		    wrapper = getMatch(wrapper.getPath() +
  -                        (pathInfo == null ? "" : pathInfo));
  -		    this.mapPath = this.servletPath;
  -
  -                    if (stillSearching &&
  -		        ++counter > Constants.RequestURIMatchRecursion) {
  -		        stillSearching = false;
  -		    }
  -		} else {
  -		  stillSearching = false;
  -		}
  -	    }
   
  -	    this.servletPath = servletPath;
  -	    this.pathInfo = pathInfo;
  -	}
  +        wrapper = getResolvedServlet(wrapper);
   
   	return wrapper;
       }
  @@ -247,5 +225,74 @@
   	}
   
   	return wrapper;
  +    }
  +
  +    private ServletWrapper getResolvedServlet(ServletWrapper wrapper) {
  +        if (wrapper != null) {
  +            String servletPath = this.servletPath;
  +            String pathInfo = this.pathInfo;
  +            boolean stillSearching = true;
  +            int counter = 0;
  +
  +            this.resourceName = this.servletPath;
  +
  +            while (stillSearching) {
  +                if (wrapper.getPath() != null &&
  +                    wrapper.getServletClass() == null) {
  +                        this.resourceName = wrapper.getPath();
  +                        wrapper = getMatch(wrapper.getPath() +
  +                            (pathInfo == null ? "" : pathInfo));
  +                        this.mapPath = this.servletPath;
  +
  +                        if (stillSearching &&
  +                            ++counter > Constants.RequestURIMatchRecursion) {
  +                            stillSearching = false;
  +                        }
  +                } else {
  +                    stillSearching = false;
  +                }
  +            }
  +
  +            this.servletPath = servletPath;
  +            this.pathInfo = pathInfo;
  +        }
  +
  +        return wrapper;
  +    }
  +
  +    private String getMapPath(ServletWrapper wrapper) {
  +        String mapPath = this.mapPath;
  +
  +        // XXX
  +        // this is added to make available the destination
  +        // resource be it a servlet or jsp file - could be
  +        // cleaned up a bit (wobbly)
  +        if (this.servletPath.equals(Constants.Servlet.Invoker.Map) &&
  +            this.pathInfo != null) {
  +            String s = this.pathInfo;
  +
  +            if (this.pathInfo.startsWith("/")) {
  +                s = this.pathInfo.substring(1);
  +            }
  +
  +            int i = s.indexOf("/");
  +
  +            if (i > -1) {
  +                s = s.substring(0, i);
  +            }
  +
  +            mapPath = "/" + s;
  +        } else if (mapPath == null &&
  +            this.resourceName != null) {
  +            // XXX
  +            // hack to differentiate amongst a mapped servlet and a jsp
  +            if (! wrapper.getServletName().equals(Constants.JSP.NAME)) {
  +                mapPath = "/" + wrapper.getServletClass();
  +            } else {
  +                mapPath = this.resourceName;
  +            }
  +        }
  +
  +        return mapPath;
       }
   }
  
  
  

Mime
View raw message