You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/05/20 00:45:25 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core ContainerBase.java StandardContext.java StandardContextValve.java StandardEngine.java StandardEngineValve.java StandardHost.java StandardHostValve.java FastEngineMapper.java StandardContextMapper.java StandardEngineMapper.java StandardHostMapper.java

remm        2003/05/19 15:45:25

  Modified:    catalina/src/share/org/apache/catalina/core
                        ContainerBase.java StandardContext.java
                        StandardContextValve.java StandardEngine.java
                        StandardEngineValve.java StandardHost.java
                        StandardHostValve.java
  Removed:     catalina/src/share/org/apache/catalina/core
                        FastEngineMapper.java StandardContextMapper.java
                        StandardEngineMapper.java StandardHostMapper.java
  Log:
  - Since nobody objected, remove old mapper.
  
  Revision  Changes    Path
  1.22      +0 -185    jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java
  
  Index: ContainerBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ContainerBase.java	25 Apr 2003 21:05:21 -0000	1.21
  +++ ContainerBase.java	19 May 2003 22:45:23 -0000	1.22
  @@ -89,7 +89,6 @@
   import org.apache.catalina.Loader;
   import org.apache.catalina.Logger;
   import org.apache.catalina.Manager;
  -import org.apache.catalina.Mapper;
   import org.apache.catalina.Pipeline;
   import org.apache.catalina.Realm;
   import org.apache.catalina.Request;
  @@ -245,24 +244,6 @@
   
   
       /**
  -     * The one and only Mapper associated with this Container, if any.
  -     */
  -    protected Mapper mapper = null;
  -
  -
  -    /**
  -     * The set of Mappers associated with this Container, keyed by protocol.
  -     */
  -    protected HashMap mappers = new HashMap();
  -
  -
  -    /**
  -     * The Java class name of the default Mapper class for this Container.
  -     */
  -    protected String mapperClass = null;
  -
  -
  -    /**
        * The human-readable name of this Container.
        */
       protected String name = null;
  @@ -870,42 +851,6 @@
   
   
       /**
  -     * Add the specified Mapper associated with this Container.
  -     *
  -     * @param mapper The corresponding Mapper implementation
  -     *
  -     * @exception IllegalArgumentException if this exception is thrown by
  -     *  the <code>setContainer()</code> method of the Mapper
  -     */
  -    public void addMapper(Mapper mapper) {
  -
  -        synchronized(mappers) {
  -            if (mappers.get(mapper.getProtocol()) != null)
  -                throw new IllegalArgumentException("addMapper:  Protocol '" +
  -                                                   mapper.getProtocol() +
  -                                                   "' is not unique");
  -            mapper.setContainer((Container) this);      // May throw IAE
  -            if (started && (mapper instanceof Lifecycle)) {
  -                try {
  -                    ((Lifecycle) mapper).start();
  -                } catch (LifecycleException e) {
  -                    log.error("ContainerBase.addMapper: start: ", e);
  -                    throw new IllegalStateException
  -                        ("ContainerBase.addMapper: start: " + e);
  -                }
  -            }
  -            mappers.put(mapper.getProtocol(), mapper);
  -            if (mappers.size() == 1)
  -                this.mapper = mapper;
  -            else
  -                this.mapper = null;
  -            fireContainerEvent(ADD_MAPPER_EVENT, mapper);
  -        }
  -
  -    }
  -
  -
  -    /**
        * Add a property change listener to this component.
        *
        * @param listener The listener to add
  @@ -965,39 +910,6 @@
   
   
       /**
  -     * Return the Mapper associated with the specified protocol, if there
  -     * is one.  If there is only one defined Mapper, use it for all protocols.
  -     * If there is no matching Mapper, return <code>null</code>.
  -     *
  -     * @param protocol Protocol for which to find a Mapper
  -     */
  -    public Mapper findMapper(String protocol) {
  -
  -        if (mapper != null)
  -            return (mapper);
  -        else
  -            synchronized (mappers) {
  -                return ((Mapper) mappers.get(protocol));
  -            }
  -
  -    }
  -
  -
  -    /**
  -     * Return the set of Mappers associated with this Container.  If this
  -     * Container has no Mappers, a zero-length array is returned.
  -     */
  -    public Mapper[] findMappers() {
  -
  -        synchronized (mappers) {
  -            Mapper results[] = new Mapper[mappers.size()];
  -            return ((Mapper[]) mappers.values().toArray(results));
  -        }
  -
  -    }
  -
  -
  -    /**
        * Process the specified Request, to produce the corresponding Response,
        * by invoking the first Valve in our pipeline (if any), or the basic
        * Valve otherwise.
  @@ -1021,27 +933,6 @@
   
   
       /**
  -     * Return the child Container that should be used to process this Request,
  -     * based upon its characteristics.  If no such child Container can be
  -     * identified, return <code>null</code> instead.
  -     *
  -     * @param request Request being processed
  -     * @param update Update the Request to reflect the mapping selection?
  -     */
  -    public Container map(Request request, boolean update) {
  -
  -        // Select the Mapper we will use
  -        Mapper mapper = findMapper(request.getRequest().getProtocol());
  -        if (mapper == null)
  -            return (null);
  -
  -        // Use this Mapper to perform this mapping
  -        return (mapper.map(request, update));
  -
  -    }
  -
  -
  -    /**
        * Remove an existing child Container from association with this parent
        * Container.
        *
  @@ -1091,39 +982,6 @@
   
   
       /**
  -     * Remove a Mapper associated with this Container, if any.
  -     *
  -     * @param mapper The Mapper to be removed
  -     */
  -    public void removeMapper(Mapper mapper) {
  -
  -        synchronized(mappers) {
  -
  -            if (mappers.get(mapper.getProtocol()) == null)
  -                return;
  -            mappers.remove(mapper.getProtocol());
  -            if (started && (mapper instanceof Lifecycle)) {
  -                try {
  -                    ((Lifecycle) mapper).stop();
  -                } catch (LifecycleException e) {
  -                    log.error("ContainerBase.removeMapper: stop: ", e);
  -                    throw new IllegalStateException
  -                        ("ContainerBase.removeMapper: stop: " + e);
  -                }
  -            }
  -            if (mappers.size() != 1)
  -                this.mapper = null;
  -            else {
  -                Iterator values = mappers.values().iterator();
  -                this.mapper = (Mapper) values.next();
  -            }
  -            fireContainerEvent(REMOVE_MAPPER_EVENT, mapper);
  -        }
  -
  -    }
  -
  -
  -    /**
        * Remove a property change listener from this component.
        *
        * @param listener The listener to remove
  @@ -1202,7 +1060,6 @@
           // Notify our interested LifecycleListeners
           lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
   
  -        addDefaultMapper(this.mapperClass);
           started = true;
   
           // Start our subordinate components, if any
  @@ -1219,13 +1076,6 @@
           if ((resources != null) && (resources instanceof Lifecycle))
               ((Lifecycle) resources).start();
   
  -        // Start our Mappers, if any
  -        Mapper mappers[] = findMappers();
  -        for (int i = 0; i < mappers.length; i++) {
  -            if (mappers[i] instanceof Lifecycle)
  -                ((Lifecycle) mappers[i]).start();
  -        }
  -
           // Start our child containers, if any
           Container children[] = findChildren();
           for (int i = 0; i < children.length; i++) {
  @@ -1284,13 +1134,6 @@
               removeChild(children[i]);
           }
   
  -        // Stop our Mappers, if any
  -        Mapper mappers[] = findMappers();
  -        for (int i = 0; i < mappers.length; i++) {
  -            if (mappers[(mappers.length-1)-i] instanceof Lifecycle)
  -                ((Lifecycle) mappers[(mappers.length-1)-i]).stop();
  -        }
  -
           // Stop our subordinate components, if any
           if ((resources != null) && (resources instanceof Lifecycle)) {
               ((Lifecycle) resources).stop();
  @@ -1475,34 +1318,6 @@
   
   
       // ------------------------------------------------------ Protected Methods
  -
  -
  -    /**
  -     * Add a default Mapper implementation if none have been configured
  -     * explicitly.
  -     *
  -     * @param mapperClass Java class name of the default Mapper
  -     */
  -    protected void addDefaultMapper(String mapperClass) {
  -
  -        // Do we need a default Mapper?
  -        if (mapperClass == null)
  -            return;
  -        if (mappers.size() >= 1)
  -            return;
  -
  -        // Instantiate and add a default Mapper
  -        try {
  -            Class clazz = Class.forName(mapperClass);
  -            Mapper mapper = (Mapper) clazz.newInstance();
  -            mapper.setProtocol("http");
  -            addMapper(mapper);
  -        } catch (Exception e) {
  -            log.error(sm.getString("containerBase.addDefaultMapper", mapperClass),
  -                e);
  -        }
  -
  -    }
   
   
       /**
  
  
  
  1.54      +1 -61     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.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- StandardContext.java	19 May 2003 21:54:08 -0000	1.53
  +++ StandardContext.java	19 May 2003 22:45:23 -0000	1.54
  @@ -351,13 +351,6 @@
   
   
       /**
  -     * The Java class name of the default Mapper class for this Container.
  -     */
  -    private String mapperClass =
  -        "org.apache.catalina.core.StandardContextMapper";
  -
  -
  -    /**
        * The message destinations for this web application.
        */
       private HashMap messageDestinations = new HashMap();
  @@ -1396,30 +1389,6 @@
       }
   
   
  -    /**
  -     * Return the default Mapper class name.
  -     */
  -    public String getMapperClass() {
  -
  -        return (this.mapperClass);
  -
  -    }
  -
  -
  -    /**
  -     * Set the default Mapper class name.
  -     *
  -     * @param mapperClass The new default Mapper class name
  -     */
  -    public void setMapperClass(String mapperClass) {
  -
  -        String oldMapperClass = this.mapperClass;
  -        this.mapperClass = mapperClass;
  -        support.firePropertyChange("mapperClass",
  -                                   oldMapperClass, this.mapperClass);
  -
  -    }
  -
       /** Get the absolute path to the work dir.
        *  To avoid duplication.
        * 
  @@ -4054,7 +4023,6 @@
   
               try {
   
  -                addDefaultMapper(this.mapperClass);
                   started = true;
   
                   // Start our subordinate components, if any
  @@ -4076,14 +4044,6 @@
                   if ((resources != null) && (resources instanceof Lifecycle))
                       ((Lifecycle) resources).start();
   
  -                // Start our Mappers, if any
  -                // FIXME: Remove this
  -                Mapper mappers[] = findMappers();
  -                for (int i = 0; i < mappers.length; i++) {
  -                    if (mappers[i] instanceof Lifecycle)
  -                        ((Lifecycle) mappers[i]).start();
  -                }
  -
                   // Initialize associated mapper
                   mapper.setContext(welcomeFiles, resources);
   
  @@ -4326,13 +4286,6 @@
                       ((Lifecycle) children[i]).stop();
               }
   
  -            // Stop our Mappers, if any
  -            Mapper mappers[] = findMappers();
  -            for (int i = 0; i < mappers.length; i++) {
  -                if (mappers[(mappers.length-1)-i] instanceof Lifecycle)
  -                    ((Lifecycle) mappers[(mappers.length-1)-i]).stop();
  -            }
  -
               // Stop resources
               resourcesStop();
   
  @@ -4423,19 +4376,6 @@
   
   
       // ------------------------------------------------------ Protected Methods
  -
  -
  -    /**
  -     * Add a default Mapper implementation if none have been configured
  -     * explicitly.
  -     *
  -     * @param mapperClass Java class name of the default Mapper
  -     */
  -    protected void addDefaultMapper(String mapperClass) {
  -
  -        super.addDefaultMapper(this.mapperClass);
  -
  -    }
   
   
       /**
  
  
  
  1.6       +5 -18     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContextValve.java
  
  Index: StandardContextValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContextValve.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StandardContextValve.java	29 Jan 2003 21:23:29 -0000	1.5
  +++ StandardContextValve.java	19 May 2003 22:45:24 -0000	1.6
  @@ -172,26 +172,13 @@
               return;
           }
   
  -        Context context = (Context) getContainer();
  -
           // Select the Wrapper to be used for this Request
  -        Wrapper wrapper = null;
  -        try {
  -            wrapper = (Wrapper) context.map(request, true);
  -        } catch (IllegalArgumentException e) {
  -            String requestURI = hreq.getDecodedRequestURI();
  -            badRequest(requestURI, 
  -                       (HttpServletResponse) response.getResponse());
  -            return;
  -        }
  +        Wrapper wrapper = request.getWrapper();
           if (wrapper == null) {
               String requestURI = hreq.getDecodedRequestURI();
               notFound(requestURI, (HttpServletResponse) response.getResponse());
               return;
           }
  -
  -        // Ask this Wrapper to process this Request
  -        response.setContext(context);
   
           wrapper.invoke(request, response);
   
  
  
  
  1.19      +1 -45     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java
  
  Index: StandardEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- StandardEngine.java	24 Apr 2003 21:14:21 -0000	1.18
  +++ StandardEngine.java	19 May 2003 22:45:24 -0000	1.19
  @@ -133,13 +133,6 @@
   
   
       /**
  -     * The Java class name of the default Mapper class for this Container.
  -     */
  -    private String mapperClass =
  -        "org.apache.catalina.core.StandardEngineMapper";
  -
  -
  -    /**
        * The <code>Service</code> that owns this Engine, if any.
        */
       private Service service = null;
  @@ -280,31 +273,6 @@
   
   
       /**
  -     * Return the default Mapper class name.
  -     */
  -    public String getMapperClass() {
  -
  -        return (this.mapperClass);
  -
  -    }
  -
  -
  -    /**
  -     * Set the default Mapper class name.
  -     *
  -     * @param mapperClass The new default Mapper class name
  -     */
  -    public void setMapperClass(String mapperClass) {
  -
  -        String oldMapperClass = this.mapperClass;
  -        this.mapperClass = mapperClass;
  -        support.firePropertyChange("mapperClass",
  -                                   oldMapperClass, this.mapperClass);
  -
  -    }
  -
  -
  -    /**
        * Return the <code>Service</code> with which we are associated (if any).
        */
       public Service getService() {
  @@ -560,18 +528,6 @@
   
       // ------------------------------------------------------ Protected Methods
   
  -
  -    /**
  -     * Add a default Mapper implementation if none have been configured
  -     * explicitly.
  -     *
  -     * @param mapperClass The default mapper class name to add
  -     */
  -    protected void addDefaultMapper(String mapperClass) {
  -
  -        super.addDefaultMapper(this.mapperClass);
  -
  -    }
   
       // -------------------- JMX registration  --------------------
   
  
  
  
  1.3       +5 -12     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngineValve.java
  
  Index: StandardEngineValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardEngineValve.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StandardEngineValve.java	28 Jan 2003 18:21:16 -0000	1.2
  +++ StandardEngineValve.java	19 May 2003 22:45:24 -0000	1.3
  @@ -142,15 +142,8 @@
                          ValveContext valveContext)
           throws IOException, ServletException {
   
  -        // Validate the request and response object types
  -        if (!(request.getRequest() instanceof HttpServletRequest) ||
  -            !(response.getResponse() instanceof HttpServletResponse)) {
  -            return;     // NOTE - Not much else we can do generically
  -        }
  -
           // Select the Host to be used for this Request
  -        StandardEngine engine = (StandardEngine) getContainer();
  -        Host host = (Host) engine.map(request, true);
  +        Host host = request.getHost();
           if (host == null) {
               ((HttpServletResponse) response.getResponse()).sendError
                   (HttpServletResponse.SC_BAD_REQUEST,
  
  
  
  1.14      +1 -45     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java
  
  Index: StandardHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StandardHost.java	23 Apr 2003 16:14:09 -0000	1.13
  +++ StandardHost.java	19 May 2003 22:45:24 -0000	1.14
  @@ -184,13 +184,6 @@
   
   
       /**
  -     * The Java class name of the default Mapper class for this Container.
  -     */
  -    private String mapperClass =
  -        "org.apache.catalina.core.StandardHostMapper";
  -
  -
  -    /**
        * Unpack WARs property.
        */
       private boolean unpackWARs = true;
  @@ -406,31 +399,6 @@
   
   
       /**
  -     * Return the default Mapper class name.
  -     */
  -    public String getMapperClass() {
  -
  -        return (this.mapperClass);
  -
  -    }
  -
  -
  -    /**
  -     * Set the default Mapper class name.
  -     *
  -     * @param mapperClass The new default Mapper class name
  -     */
  -    public void setMapperClass(String mapperClass) {
  -
  -        String oldMapperClass = this.mapperClass;
  -        this.mapperClass = mapperClass;
  -        support.firePropertyChange("mapperClass",
  -                                   oldMapperClass, this.mapperClass);
  -
  -    }
  -
  -
  -    /**
        * Return the Java class name of the error report valve class
        * for new web applications.
        */
  @@ -986,18 +954,6 @@
   
       // ------------------------------------------------------ Protected Methods
   
  -
  -    /**
  -     * Add a default Mapper implementation if none have been configured
  -     * explicitly.
  -     *
  -     * @param mapperClass Java class name of the default Mapper
  -     */
  -    protected void addDefaultMapper(String mapperClass) {
  -
  -        super.addDefaultMapper(this.mapperClass);
  -
  -    }
   
       static String STANDARD_HOST_DEPLOYER="org.apache.catalina.core.StandardHostDeployer";
       
  
  
  
  1.4       +5 -14     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java
  
  Index: StandardHostValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardHostValve.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardHostValve.java	5 Apr 2003 03:57:58 -0000	1.3
  +++ StandardHostValve.java	19 May 2003 22:45:24 -0000	1.4
  @@ -144,17 +144,8 @@
                          ValveContext valveContext)
           throws IOException, ServletException {
   
  -        // Validate the request and response object types
  -        // XXX This should move to Engine ( the entry point )
  -        // will it be skiped if the mapper maps the valve ? 
  -        if (!(request.getRequest() instanceof HttpServletRequest) ||
  -            !(response.getResponse() instanceof HttpServletResponse)) {
  -            return;     // NOTE - Not much else we can do generically
  -        }
  -
           // Select the Context to be used for this Request
  -        StandardHost host = (StandardHost) getContainer();
  -        Context context = (Context) host.map(request, true);
  +        Context context = request.getContext();
           if (context == null) {
               ((HttpServletResponse) response.getResponse()).sendError
                   (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
  
  
  

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