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/webapps/docs changelog.xml
Date Sat, 04 Jun 2005 17:34:23 GMT
remm        2005/06/04 10:34:23

  Modified:    webapps/docs/config http.xml ajp.xml
               catalina/src/share/org/apache/catalina/connector
                        Connector.java
               util/java/org/apache/tomcat/util/http/mapper Mapper.java
               webapps/docs changelog.xml
  Removed:     util/java/org/apache/tomcat/util/http/mapper HostMap.java
  Log:
  - Revert patch.
  
  Revision  Changes    Path
  1.25      +0 -7      jakarta-tomcat-catalina/webapps/docs/config/http.xml
  
  Index: http.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/config/http.xml,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- http.xml	4 Jun 2005 12:33:38 -0000	1.24
  +++ http.xml	4 Jun 2005 17:34:23 -0000	1.25
  @@ -57,13 +57,6 @@
   
     <attributes>
    
  -    <attribute name="allowedAliasMatches" required="false">
  -      <p>Set this attribute to max subdomain alias matches <code>16</code>. 
  -      Is this attribute >0 the host alias element support Alias Matches 
  -      (&lt;Alias&gt;*.mydomain.net"&lt;/Alias&gt; ).
  -      The default value is <code>0</code> no host alias matches support.</p>
  -    </attribute>
  - 
       <attribute name="allowTrace" required="false">
         <p>A boolean value which can be used to enable or disable the TRACE
         HTTP method. If not specified, this attribute is set to false.</p>
  
  
  
  1.17      +0 -7      jakarta-tomcat-catalina/webapps/docs/config/ajp.xml
  
  Index: ajp.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/config/ajp.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ajp.xml	4 Jun 2005 12:33:38 -0000	1.16
  +++ ajp.xml	4 Jun 2005 17:34:23 -0000	1.17
  @@ -52,13 +52,6 @@
   
     <attributes>
   
  -    <attribute name="allowedAliasMatches" required="false">
  -      <p>Set this attribute to max subdomain alias matches <code>16</code>. 
  -      Is this attribute >0 the host alias element support Alias Matches 
  -      (&lt;Alias&gt;*.mydomain.net"&lt;/Alias&gt; ).
  -      The default value is <code>0</code> no host alias matches support.</p>
  -    </attribute>
  -
       <attribute name="allowTrace" required="false">
         <p>A boolean value which can be used to enable or disable the TRACE
         HTTP method. If not specified, this attribute is set to false.</p>
  
  
  
  1.23      +1 -7      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Connector.java
  
  Index: Connector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Connector.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Connector.java	4 Jun 2005 12:33:38 -0000	1.22
  +++ Connector.java	4 Jun 2005 17:34:23 -0000	1.23
  @@ -42,8 +42,6 @@
   import org.apache.tomcat.util.IntrospectionUtils;
   import org.apache.tomcat.util.http.mapper.Mapper;
   
  -import com.sun.org.apache.bcel.internal.generic.ALOAD;
  -
   
   /**
    * Implementation of a Coyote connector for Tomcat 5.x.
  @@ -1106,10 +1104,6 @@
           }
   
           if( this.domain != null ) {
  -            Object allowedAliasMatches = getProperty("allowedAliasMatches") ;
  -            if(allowedAliasMatches != null && allowedAliasMatches instanceof String )
  -                IntrospectionUtils.setProperty(mapper, "allowedAliasMatches",
  -                    (String)allowedAliasMatches);
               mapperListener.setDomain( domain );
               //mapperListener.setEngine( service.getContainer().getName() );
               mapperListener.init();
  @@ -1119,7 +1113,7 @@
                       log.debug(sm.getString(
                               "coyoteConnector.MapperRegistration", mapperOname));
                   Registry.getRegistry(null, null).registerComponent
  -                    (mapper, mapperOname, "Mapper");
  +                    (mapper, createObjectName(this.domain,"Mapper"), "Mapper");
               } catch (Exception ex) {
                   log.error(sm.getString
                           ("coyoteConnector.protocolRegistrationFailed"), ex);
  
  
  
  1.46      +308 -506  jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/mapper/Mapper.java
  
  Index: Mapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/mapper/Mapper.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- Mapper.java	4 Jun 2005 12:32:53 -0000	1.45
  +++ Mapper.java	4 Jun 2005 17:34:23 -0000	1.46
  @@ -16,38 +16,33 @@
   
   package org.apache.tomcat.util.http.mapper;
   
  -import java.util.List;
  -import java.util.ArrayList;
  -
  -import javax.naming.directory.DirContext;
   import javax.naming.NamingException;
  +import javax.naming.directory.DirContext;
   
  -import org.apache.tomcat.util.buf.Ascii;
   import org.apache.tomcat.util.buf.CharChunk;
   import org.apache.tomcat.util.buf.MessageBytes;
  +import org.apache.tomcat.util.buf.Ascii;
  +import java.util.List;
  +import java.util.ArrayList;
   
   /**
    * Mapper, which implements the servlet API mapping rules (which are derived
    * from the HTTP rules).
    *
    * @author Remy Maucherat
  - * @author George Sexton
  - * @author Peter Rossbach
    */
   public final class Mapper {
   
   
       private static org.apache.commons.logging.Log logger =
  -    org.apache.commons.logging.LogFactory.getLog(Mapper.class);
  +        org.apache.commons.logging.LogFactory.getLog(Mapper.class);
       // ----------------------------------------------------- Instance Variables
   
   
  -    HostMap hostMap=new HostMap();
  -
       /**
  -     * Default number of alias matches for each host.
  +     * Array containing the virtual hosts definitions.
        */
  -    private int defaultAliasMatches=0;
  +    protected Host[] hosts = new Host[0];
   
   
       /**
  @@ -56,12 +51,6 @@
       protected String defaultHostName = null;
   
       /**
  -     * Default host, already looked up cached to 
  -     * eliminate lookup.
  -     */
  -    protected Host defaultHost=null;
  -
  -    /**
        * Context associated with this wrapper, used for wrapper mapping.
        */
       protected Context context = new Context();
  @@ -69,23 +58,6 @@
   
       // --------------------------------------------------------- Public Methods
   
  -    /**
  -     * Set the number of allowed alias matches. If this number is
  -     * non-zero, then wild-card host matching is enabled. This 
  -     * number limits the number of wild-card host matches in
  -     * order to prevent a denial of service attack.
  -     */
  -    public void setAllowedAliasMatches(final int matches){
  -        defaultAliasMatches=matches;
  -        hostMap.setEnableWildCardMatching(matches>0);
  -    }
  -
  -    /**
  -     * 
  -     */
  -    public int getAllowedAliasMatches(){
  -        return defaultAliasMatches;
  -    }
   
       /**
        * Get default host.
  @@ -104,21 +76,9 @@
        */
       public void setDefaultHostName(String defaultHostName) {
           this.defaultHostName = defaultHostName;
  -        defaultHost=null;
       }
   
       /**
  -     * Return the default host, or null if the host
  -     * has not been set.
  -     */
  -    private Host getDefaultHost(){
  -        if (defaultHost==null && defaultHostName!=null) {
  -            defaultHost=hostMap.getHost(defaultHostName);
  -        }
  -        return defaultHost;
  -    }
  -    
  -    /**
        * Add a new host to the mapper.
        *
        * @param name Virtual host name
  @@ -126,30 +86,25 @@
        */
       public synchronized void addHost(String name, String[] aliases,
                                        Object host) {
  -        HostMap hm=hostMap;
  -        if (hm.contains(name)) {
  -            return;
  -        }
  -        hm=new HostMap(hm);
  -        
  -        Host newHost=new Host();
  -        ContextList contextList=new ContextList();
  -        newHost.name=name;
  -        newHost.contextList=contextList;
  -        newHost.object=host;
  -        newHost.aliasMatchesRemaining=defaultAliasMatches;
  -        hm.addHost(newHost);
  -        for (int i=0; i < aliases.length; i++) {
  -            if (!hm.contains(aliases[i])) {
  -                newHost=new Host();
  -                newHost.aliasMatchesRemaining=defaultAliasMatches;
  -                newHost.name=aliases[i];
  -                newHost.contextList=contextList;
  -                newHost.object=host;
  -                hm.addHost(newHost);
  +        Host[] newHosts = new Host[hosts.length + 1];
  +        Host newHost = new Host();
  +        ContextList contextList = new ContextList();
  +        newHost.name = name;
  +        newHost.contextList = contextList;
  +        newHost.object = host;
  +        if (insertMap(hosts, newHosts, newHost)) {
  +            hosts = newHosts;
  +        }
  +        for (int i = 0; i < aliases.length; i++) {
  +            newHosts = new Host[hosts.length + 1];
  +            newHost = new Host();
  +            newHost.name = aliases[i];
  +            newHost.contextList = contextList;
  +            newHost.object = host;
  +            if (insertMap(hosts, newHosts, newHost)) {
  +                hosts = newHosts;
               }
           }
  -        hostMap=hm;
       }
   
   
  @@ -159,20 +114,33 @@
        * @param name Virtual host name
        */
       public synchronized void removeHost(String name) {
  -
  -        if (!hostMap.contains(name)) {
  +        // Find and remove the old host
  +        int pos = find(hosts, name);
  +        if (pos < 0) {
               return;
           }
  -        HostMap hm=new HostMap(hostMap);
  -        hm.removeHost(name);
  -        hostMap=hm;
  +        Object host = hosts[pos].object;
  +        Host[] newHosts = new Host[hosts.length - 1];
  +        if (removeMap(hosts, newHosts, name)) {
  +            hosts = newHosts;
  +        }
  +        // Remove all aliases (they will map to the same host object)
  +        for (int i = 0; i < newHosts.length; i++) {
  +            if (newHosts[i].object == host) {
  +                Host[] newHosts2 = new Host[hosts.length - 1];
  +                if (removeMap(hosts, newHosts2, newHosts[i].name)) {
  +                    hosts = newHosts2;
  +                }
  +            }
  +        }
       }
  - 
  -    /**
  -     * Get current host matching map
  -     */
  +
       public String[] getHosts() {
  -        return hostMap.getHosts();
  +        String hostN[] = new String[hosts.length];
  +        for( int i = 0; i < hosts.length; i++ ) {
  +            hostN[i] = hosts[i].name;
  +        }
  +        return hostN;
       }
   
   
  @@ -200,31 +168,40 @@
        * @param resources Static resources of the context
        */
       public void addContext
  -    (String hostName, String path, Object context,
  -     String[] welcomeResources, javax.naming.Context resources) {
  +        (String hostName, String path, Object context,
  +         String[] welcomeResources, javax.naming.Context resources) {
   
  -        Host host=hostMap.getHost(hostName);
  -        if (host==null) {
  +        Host[] hosts = this.hosts;
  +        int pos = find(hosts, hostName);
  +        if( pos <0 ) {
               addHost(hostName, new String[0], "");
  -            host=hostMap.getHost(hostName);
  +            hosts = this.hosts;
  +            pos = find(hosts, hostName);
           }
  -        int slashCount = slashCount(path);
  -        synchronized (host) {
  -            Context[] contexts = host.contextList.contexts;
  -            // Update nesting
  -            if (slashCount > host.contextList.nesting) {
  -                host.contextList.nesting = slashCount;
  -            }
  -            Context[] newContexts = new Context[contexts.length + 1];
  -            Context newContext = new Context();
  -            newContext.name = path;
  -            newContext.object = context;
  -            newContext.welcomeResources = welcomeResources;
  -            newContext.resources = resources;
  -            if (insertMap(contexts, newContexts, newContext)) {
  -                host.contextList.contexts = newContexts;
  +        if (pos < 0) {
  +            logger.error("No host found: " + hostName);
  +        }
  +        Host host = hosts[pos];
  +        if (host.name.equals(hostName)) {
  +            int slashCount = slashCount(path);
  +            synchronized (host) {
  +                Context[] contexts = host.contextList.contexts;
  +                // Update nesting
  +                if (slashCount > host.contextList.nesting) {
  +                    host.contextList.nesting = slashCount;
  +                }
  +                Context[] newContexts = new Context[contexts.length + 1];
  +                Context newContext = new Context();
  +                newContext.name = path;
  +                newContext.object = context;
  +                newContext.welcomeResources = welcomeResources;
  +                newContext.resources = resources;
  +                if (insertMap(contexts, newContexts, newContext)) {
  +                    host.contextList.contexts = newContexts;
  +                }
               }
           }
  +
       }
   
   
  @@ -235,29 +212,32 @@
        * @param path Context path
        */
       public void removeContext(String hostName, String path) {
  -        Host host=hostMap.getHost(hostName);
  -        if (host==null) {
  +        Host[] hosts = this.hosts;
  +        int pos = find(hosts, hostName);
  +        if (pos < 0) {
               return;
           }
  -        synchronized (host) {
  -            Context[] contexts = host.contextList.contexts;
  -            if ( contexts.length == 0 ) {
  -                return;
  -            }
  -            Context[] newContexts = new Context[contexts.length - 1];
  -            if (removeMap(contexts, newContexts, path)) {
  -                host.contextList.contexts = newContexts;
  -                // Recalculate nesting
  -                host.contextList.nesting = 0;
  -                for (int i = 0; i < newContexts.length; i++) {
  -                    int slashCount = slashCount(newContexts[i].name);
  -                    if (slashCount > host.contextList.nesting) {
  -                        host.contextList.nesting = slashCount;
  +        Host host = hosts[pos];
  +        if (host.name.equals(hostName)) {
  +            synchronized (host) {
  +                Context[] contexts = host.contextList.contexts;
  +                if( contexts.length == 0 ){
  +                    return;
  +                }
  +                Context[] newContexts = new Context[contexts.length - 1];
  +                if (removeMap(contexts, newContexts, path)) {
  +                    host.contextList.contexts = newContexts;
  +                    // Recalculate nesting
  +                    host.contextList.nesting = 0;
  +                    for (int i = 0; i < newContexts.length; i++) {
  +                        int slashCount = slashCount(newContexts[i].name);
  +                        if (slashCount > host.contextList.nesting) {
  +                            host.contextList.nesting = slashCount;
  +                        }
                       }
                   }
               }
           }
  -
       }
   
   
  @@ -268,16 +248,15 @@
        */
       public String[] getContextNames() {
           List list=new ArrayList();
  -        Host[] hosts=hostMap.toHostArray();
  -        for ( int i=0; i<hosts.length; i++ ) {
  -            for ( int j=0; j<hosts[i].contextList.contexts.length; j++ ) {
  +        for( int i=0; i<hosts.length; i++ ) {
  +            for( int j=0; j<hosts[i].contextList.contexts.length; j++ ) {
                   String cname=hosts[i].contextList.contexts[j].name;
                   list.add("//" + hosts[i].name +
  -                         (cname.startsWith("/") ? cname : "/"));
  +                        (cname.startsWith("/") ? cname : "/"));
               }
           }
           String res[] = new String[list.size()];
  -        return(String[])list.toArray(res);
  +        return (String[])list.toArray(res);
       }
   
   
  @@ -297,19 +276,23 @@
   
       public void addWrapper(String hostName, String contextPath, String path,
                              Object wrapper, boolean jspWildCard) {
  -        Host host=hostMap.getHost(hostName);
  -        if (host==null) {
  -            return;
  -        }
  -        Context[] contexts = host.contextList.contexts;
  -        int pos2 = find(contexts, contextPath);
  -        if ( pos2<0 ) {
  -            logger.error("No context found: " + contextPath );
  +        Host[] hosts = this.hosts;
  +        int pos = find(hosts, hostName);
  +        if (pos < 0) {
               return;
           }
  -        Context context = contexts[pos2];
  -        if (context.name.equals(contextPath)) {
  -            addWrapper(context, path, wrapper, jspWildCard);
  +        Host host = hosts[pos];
  +        if (host.name.equals(hostName)) {
  +            Context[] contexts = host.contextList.contexts;
  +            int pos2 = find(contexts, contextPath);
  +            if( pos2<0 ) {
  +                logger.error("No context found: " + contextPath );
  +                return;
  +            }
  +            Context context = contexts[pos2];
  +            if (context.name.equals(contextPath)) {
  +                addWrapper(context, path, wrapper, jspWildCard);
  +            }
           }
       }
   
  @@ -356,7 +339,7 @@
                   newWrapper.name = path.substring(0, path.length() - 2);
                   Wrapper[] oldWrappers = context.wildcardWrappers;
                   Wrapper[] newWrappers =
  -                new Wrapper[oldWrappers.length + 1];
  +                    new Wrapper[oldWrappers.length + 1];
                   if (insertMap(oldWrappers, newWrappers, newWrapper)) {
                       context.wildcardWrappers = newWrappers;
                       int slashCount = slashCount(newWrapper.name);
  @@ -369,7 +352,7 @@
                   newWrapper.name = path.substring(2);
                   Wrapper[] oldWrappers = context.extensionWrappers;
                   Wrapper[] newWrappers =
  -                new Wrapper[oldWrappers.length + 1];
  +                    new Wrapper[oldWrappers.length + 1];
                   if (insertMap(oldWrappers, newWrappers, newWrapper)) {
                       context.extensionWrappers = newWrappers;
                   }
  @@ -382,7 +365,7 @@
                   newWrapper.name = path;
                   Wrapper[] oldWrappers = context.exactWrappers;
                   Wrapper[] newWrappers =
  -                new Wrapper[oldWrappers.length + 1];
  +                    new Wrapper[oldWrappers.length + 1];
                   if (insertMap(oldWrappers, newWrappers, newWrapper)) {
                       context.exactWrappers = newWrappers;
                   }
  @@ -409,19 +392,23 @@
        * @param path Wrapper mapping
        */
       public void removeWrapper
  -    (String hostName, String contextPath, String path) {
  -        Host host=hostMap.getHost(hostName);
  -        if (host==null) {
  +        (String hostName, String contextPath, String path) {
  +        Host[] hosts = this.hosts;
  +        int pos = find(hosts, hostName);
  +        if (pos < 0) {
               return;
           }
  -        Context[] contexts = host.contextList.contexts;
  -        int pos2 = find(contexts, contextPath);
  -        if (pos2 < 0) {
  -            return;
  -        }
  -        Context context = contexts[pos2];
  -        if (context.name.equals(contextPath)) {
  -            removeWrapper(context, path);
  +        Host host = hosts[pos];
  +        if (host.name.equals(hostName)) {
  +            Context[] contexts = host.contextList.contexts;
  +            int pos2 = find(contexts, contextPath);
  +            if (pos2 < 0) {
  +                return;
  +            }
  +            Context context = contexts[pos2];
  +            if (context.name.equals(contextPath)) {
  +                removeWrapper(context, path);
  +            }
           }
       }
   
  @@ -432,7 +419,7 @@
                   String name = path.substring(0, path.length() - 2);
                   Wrapper[] oldWrappers = context.wildcardWrappers;
                   Wrapper[] newWrappers =
  -                new Wrapper[oldWrappers.length - 1];
  +                    new Wrapper[oldWrappers.length - 1];
                   if (removeMap(oldWrappers, newWrappers, name)) {
                       // Recalculate nesting
                       context.nesting = 0;
  @@ -449,7 +436,7 @@
                   String name = path.substring(2);
                   Wrapper[] oldWrappers = context.extensionWrappers;
                   Wrapper[] newWrappers =
  -                new Wrapper[oldWrappers.length - 1];
  +                    new Wrapper[oldWrappers.length - 1];
                   if (removeMap(oldWrappers, newWrappers, name)) {
                       context.extensionWrappers = newWrappers;
                   }
  @@ -461,7 +448,7 @@
                   String name = path;
                   Wrapper[] oldWrappers = context.exactWrappers;
                   Wrapper[] newWrappers =
  -                new Wrapper[oldWrappers.length - 1];
  +                    new Wrapper[oldWrappers.length - 1];
                   if (removeMap(oldWrappers, newWrappers, name)) {
                       context.exactWrappers = newWrappers;
                   }
  @@ -472,39 +459,38 @@
       public String getWrappersString( String host, String context ) {
           String names[]=getWrapperNames(host, context);
           StringBuffer sb=new StringBuffer();
  -        for ( int i=0; i<names.length; i++ ) {
  +        for( int i=0; i<names.length; i++ ) {
               sb.append(names[i]).append(":");
           }
           return sb.toString();
       }
   
  -    public String[] getWrapperNames( String hostName, String context ) {
  +    public String[] getWrapperNames( String host, String context ) {
           List list=new ArrayList();
  -        if ( hostName==null ) hostName="";
  -        if ( context==null ) context="";
  -        Host host=hostMap.getHost(hostName);
  -        if (host!=null) {
  -
  -            for ( int j=0; j<host.contextList.contexts.length; j++ ) {
  -
  -                if ( ! context.equals( host.contextList.contexts[j].name))
  +        if( host==null ) host="";
  +        if( context==null ) context="";
  +        for( int i=0; i<hosts.length; i++ ) {
  +            if( ! host.equals( hosts[i].name ))
  +                continue;
  +            for( int j=0; j<hosts[i].contextList.contexts.length; j++ ) {
  +                if( ! context.equals( hosts[i].contextList.contexts[j].name))
                       continue;
                   // found the context
  -                Context ctx=host.contextList.contexts[j];
  +                Context ctx=hosts[i].contextList.contexts[j];
                   list.add( ctx.defaultWrapper.path);
  -                for ( int k=0; k<ctx.exactWrappers.length; k++ ) {
  +                for( int k=0; k<ctx.exactWrappers.length; k++ ) {
                       list.add( ctx.exactWrappers[k].path);
                   }
  -                for ( int k=0; k<ctx.wildcardWrappers.length; k++ ) {
  +                for( int k=0; k<ctx.wildcardWrappers.length; k++ ) {
                       list.add( ctx.wildcardWrappers[k].path + "*");
                   }
  -                for ( int k=0; k<ctx.extensionWrappers.length; k++ ) {
  +                for( int k=0; k<ctx.extensionWrappers.length; k++ ) {
                       list.add( "*." + ctx.extensionWrappers[k].path);
                   }
               }
           }
           String res[]=new String[list.size()];
  -        return(String[])list.toArray(res);
  +        return (String[])list.toArray(res);
       }
   
   
  @@ -519,7 +505,7 @@
        */
       public void map(MessageBytes host, MessageBytes uri,
                       MappingData mappingData)
  -    throws Exception {
  +        throws Exception {
   
           host.toChars();
           uri.toChars();
  @@ -537,7 +523,7 @@
        *                    operation
        */
       public void map(MessageBytes uri, MappingData mappingData)
  -    throws Exception {
  +        throws Exception {
   
           uri.toChars();
           CharChunk uricc = uri.getCharChunk();
  @@ -555,7 +541,7 @@
        */
       private final void internalMap(CharChunk host, CharChunk uri,
                                      MappingData mappingData)
  -    throws Exception {
  +        throws Exception {
   
           uri.setLimit(-1);
   
  @@ -565,16 +551,25 @@
   
           // Virtual host mapping
           if (mappingData.host == null) {
  -            Host hFound=hostMap.getHost(host);
  -            if (hFound==null) {
  -                hFound=getDefaultHost();
  -                if (hFound==null) {
  +            Host[] hosts = this.hosts;
  +            int pos = findIgnoreCase(hosts, host);
  +            if ((pos != -1) && (host.equalsIgnoreCase(hosts[pos].name))) {
  +                mappingData.host = hosts[pos].object;
  +                contexts = hosts[pos].contextList.contexts;
  +                nesting = hosts[pos].contextList.nesting;
  +            } else {
  +                if (defaultHostName == null) {
  +                    return;
  +                }
  +                pos = find(hosts, defaultHostName);
  +                if ((pos != -1) && (defaultHostName.equals(hosts[pos].name))) {
  +                    mappingData.host = hosts[pos].object;
  +                    contexts = hosts[pos].contextList.contexts;
  +                    nesting = hosts[pos].contextList.nesting;
  +                } else {
                       return;
                   }
               }
  -            mappingData.host=hFound.object;
  -            contexts = hFound.contextList.contexts;
  -            nesting = hFound.contextList.nesting;
           }
   
           // Context mapping
  @@ -635,7 +630,7 @@
        */
       private final void internalMapWrapper(Context context, CharChunk path,
                                             MappingData mappingData)
  -    throws Exception {
  +        throws Exception {
   
           int pathOffset = path.getOffset();
           int pathEnd = path.getEnd();
  @@ -687,10 +682,10 @@
               }
           }
   
  -        if (mappingData.wrapper == null && noServletPath) {
  +        if(mappingData.wrapper == null && noServletPath) {
               // The path is empty, redirect to "/"
               mappingData.redirectPath.setChars
  -            (path.getBuffer(), pathOffset, pathEnd);
  +                (path.getBuffer(), pathOffset, pathEnd);
               path.setEnd(pathEnd - 1);
               return;
           }
  @@ -710,7 +705,7 @@
               }
               if (checkWelcomeFiles) {
                   for (int i = 0; (i < context.welcomeResources.length)
  -                    && (mappingData.wrapper == null); i++) {
  +                         && (mappingData.wrapper == null); i++) {
                       path.setOffset(pathOffset);
                       path.setEnd(pathEnd);
                       path.append(context.welcomeResources[i], 0,
  @@ -723,8 +718,8 @@
                       // Rule 4b -- Welcome resources processing for prefix match
                       if (mappingData.wrapper == null) {
                           internalMapWildcardWrapper
  -                        (wildcardWrappers, context.nesting, 
  -                         path, mappingData);
  +                            (wildcardWrappers, context.nesting, 
  +                             path, mappingData);
                       }
   
                       // Rule 4c -- Welcome resources processing
  @@ -735,7 +730,7 @@
                           String pathStr = path.toString();
                           try {
                               file = context.resources.lookup(pathStr);
  -                        } catch (NamingException nex) {
  +                        } catch(NamingException nex) {
                               // Swallow not found, since this is normal
                           }
                           if (file != null && !(file instanceof DirContext) ) {
  @@ -744,13 +739,13 @@
                               if (mappingData.wrapper == null
                                   && context.defaultWrapper != null) {
                                   mappingData.wrapper =
  -                                context.defaultWrapper.object;
  +                                    context.defaultWrapper.object;
                                   mappingData.requestPath.setChars
  -                                (path.getBuffer(), path.getStart(), 
  -                                 path.getLength());
  +                                    (path.getBuffer(), path.getStart(), 
  +                                     path.getLength());
                                   mappingData.wrapperPath.setChars
  -                                (path.getBuffer(), path.getStart(), 
  -                                 path.getLength());
  +                                    (path.getBuffer(), path.getStart(), 
  +                                     path.getLength());
                                   mappingData.requestPath.setString(pathStr);
                                   mappingData.wrapperPath.setString(pathStr);
                               }
  @@ -761,7 +756,7 @@
                   path.setOffset(servletPath);
                   path.setEnd(pathEnd);
               }
  -
  +                                        
           }
   
   
  @@ -770,9 +765,9 @@
               if (context.defaultWrapper != null) {
                   mappingData.wrapper = context.defaultWrapper.object;
                   mappingData.requestPath.setChars
  -                (path.getBuffer(), path.getStart(), path.getLength());
  +                    (path.getBuffer(), path.getStart(), path.getLength());
                   mappingData.wrapperPath.setChars
  -                (path.getBuffer(), path.getStart(), path.getLength());
  +                    (path.getBuffer(), path.getStart(), path.getLength());
               }
               // Redirection to a folder
               char[] buf = path.getBuffer();
  @@ -781,7 +776,7 @@
                   String pathStr = path.toString();
                   try {
                       file = context.resources.lookup(pathStr);
  -                } catch (NamingException nex) {
  +                } catch(NamingException nex) {
                       // Swallow, since someone else handles the 404
                   }
                   if (file != null && file instanceof DirContext) {
  @@ -791,7 +786,7 @@
                       path.setOffset(pathOffset);
                       path.append('/');
                       mappingData.redirectPath.setChars
  -                    (path.getBuffer(), path.getStart(), path.getLength());
  +                        (path.getBuffer(), path.getStart(), path.getLength());
                   } else {
                       mappingData.requestPath.setString(pathStr);
                       mappingData.wrapperPath.setString(pathStr);
  @@ -809,7 +804,7 @@
        * Exact mapping.
        */
       private final void internalMapExactWrapper
  -    (Wrapper[] wrappers, CharChunk path, MappingData mappingData) {
  +        (Wrapper[] wrappers, CharChunk path, MappingData mappingData) {
           int pos = find(wrappers, path);
           if ((pos != -1) && (path.equals(wrappers[pos].name))) {
               mappingData.requestPath.setString(wrappers[pos].name);
  @@ -823,8 +818,8 @@
        * Wildcard mapping.
        */
       private final void internalMapWildcardWrapper
  -    (Wrapper[] wrappers, int nesting, CharChunk path, 
  -     MappingData mappingData) {
  +        (Wrapper[] wrappers, int nesting, CharChunk path, 
  +         MappingData mappingData) {
   
           int pathEnd = path.getEnd();
           int pathOffset = path.getOffset();
  @@ -858,12 +853,12 @@
                   mappingData.wrapperPath.setString(wrappers[pos].name);
                   if (path.getLength() > length) {
                       mappingData.pathInfo.setChars
  -                    (path.getBuffer(),
  -                     path.getOffset() + length,
  -                     path.getLength() - length);
  +                        (path.getBuffer(),
  +                         path.getOffset() + length,
  +                         path.getLength() - length);
                   }
                   mappingData.requestPath.setChars
  -                (path.getBuffer(), path.getOffset(), path.getLength());
  +                    (path.getBuffer(), path.getOffset(), path.getLength());
                   mappingData.wrapper = wrappers[pos].object;
                   mappingData.jspWildCard = wrappers[pos].jspWildCard;
               }
  @@ -875,7 +870,7 @@
        * Extension mappings.
        */
       private final void internalMapExtensionWrapper
  -    (Wrapper[] wrappers, CharChunk path, MappingData mappingData) {
  +        (Wrapper[] wrappers, CharChunk path, MappingData mappingData) {
           char[] buf = path.getBuffer();
           int pathEnd = path.getEnd();
           int servletPath = path.getOffset();
  @@ -901,9 +896,9 @@
                   if ((pos != -1)
                       && (path.equals(wrappers[pos].name))) {
                       mappingData.wrapperPath.setChars
  -                    (buf, servletPath, pathEnd - servletPath);
  +                        (buf, servletPath, pathEnd - servletPath);
                       mappingData.requestPath.setChars
  -                    (buf, servletPath, pathEnd - servletPath);
  +                        (buf, servletPath, pathEnd - servletPath);
                       mappingData.wrapper = wrappers[pos].object;
                   }
                   path.setOffset(servletPath);
  @@ -938,10 +933,10 @@
           if (b == -1) {
               return -1;
           }
  -
  +        
           if (compare(name, start, end, map[0].name) < 0 ) {
               return -1;
  -        }
  +        }         
           if (b == 0) {
               return 0;
           }
  @@ -985,7 +980,7 @@
        * given array.
        */
       private static final int findIgnoreCase(MapElement[] map, CharChunk name,
  -                                            int start, int end) {
  +                                  int start, int end) {
   
           int a = 0;
           int b = map.length - 1;
  @@ -996,7 +991,7 @@
           }
           if (compareIgnoreCase(name, start, end, map[0].name) < 0 ) {
               return -1;
  -        }
  +        }         
           if (b == 0) {
               return 0;
           }
  @@ -1039,10 +1034,10 @@
           if (b == -1) {
               return -1;
           }
  -
  +        
           if (name.compareTo(map[0].name) < 0) {
               return -1;
  -        }
  +        } 
           if (b == 0) {
               return 0;
           }
  @@ -1079,8 +1074,7 @@
                                        String compareTo) {
           int result = 0;
           char[] c = name.getBuffer();
  -        final int compareLen=compareTo.length();
  -        int len = compareLen;
  +        int len = compareTo.length();
           if ((end - start) < len) {
               len = end - start;
           }
  @@ -1092,9 +1086,9 @@
               }
           }
           if (result == 0) {
  -            if (compareLen > (end - start)) {
  +            if (compareTo.length() > (end - start)) {
                   result = -1;
  -            } else if (compareLen < (end - start)) {
  +            } else if (compareTo.length() < (end - start)) {
                   result = 1;
               }
           }
  @@ -1107,11 +1101,10 @@
        * Return -1, 0 or +1 if inferior, equal, or superior to the String.
        */
       private static final int compareIgnoreCase(CharChunk name, int start, int end,
  -                                               String compareTo) {
  +                                     String compareTo) {
           int result = 0;
           char[] c = name.getBuffer();
  -        final int compareLen=compareTo.length();
  -        int len = compareLen;
  +        int len = compareTo.length();
           if ((end - start) < len) {
               len = end - start;
           }
  @@ -1123,9 +1116,9 @@
               }
           }
           if (result == 0) {
  -            if (compareLen > (end - start)) {
  +            if (compareTo.length() > (end - start)) {
                   result = -1;
  -            } else if (compareLen < (end - start)) {
  +            } else if (compareTo.length() < (end - start)) {
                   result = 1;
               }
           }
  @@ -1149,7 +1142,7 @@
               }
           }
   
  -        return(pos);
  +        return (pos);
   
       }
   
  @@ -1172,7 +1165,7 @@
               }
           }
   
  -        return(pos);
  +        return (pos);
   
       }
   
  @@ -1195,7 +1188,7 @@
        * duplicates.
        */
       private static final boolean insertMap
  -    (MapElement[] oldMap, MapElement[] newMap, MapElement newElement) {
  +        (MapElement[] oldMap, MapElement[] newMap, MapElement newElement) {
           int pos = find(oldMap, newElement.name);
           if ((pos != -1) && (newElement.name.equals(oldMap[pos].name))) {
               return false;
  @@ -1203,7 +1196,7 @@
           System.arraycopy(oldMap, 0, newMap, 0, pos + 1);
           newMap[pos + 1] = newElement;
           System.arraycopy
  -        (oldMap, pos + 1, newMap, pos + 2, oldMap.length - pos - 1);
  +            (oldMap, pos + 1, newMap, pos + 2, oldMap.length - pos - 1);
           return true;
       }
   
  @@ -1212,7 +1205,7 @@
        * Insert into the right place in a sorted MapElement array.
        */
       private static final boolean removeMap
  -    (MapElement[] oldMap, MapElement[] newMap, String name) {
  +        (MapElement[] oldMap, MapElement[] newMap, String name) {
           int pos = find(oldMap, name);
           if ((pos != -1) && (name.equals(oldMap[pos].name))) {
               System.arraycopy(oldMap, 0, newMap, 0, pos);
  @@ -1239,32 +1232,9 @@
   
   
       protected static final class Host
  -    extends MapElement implements Comparable {
  +        extends MapElement {
   
           public ContextList contextList = null;
  -        public int hash;
  -        /** 
  -         * Limiter for host alias matching to prevent DOS. The default
  -         * of 0, disables alias matching.
  -         */
  -        public int aliasMatchesRemaining=0;
  -
  -        public int compareTo(Object o){
  -            int iResult=0;
  -            if (o==null) {
  -                iResult=1;
  -            } else {
  -                Host oCompare=(Host)o;
  -                if (this.hash>oCompare.hash) {
  -                    iResult=1;
  -                } else if (this.hash<oCompare.hash) {
  -                    iResult=-1;
  -                } else {
  -                    // iResult is already 0
  -                }
  -            }
  -            return iResult;
  -        }
   
       }
   
  @@ -1284,7 +1254,7 @@
   
   
       protected static final class Context
  -    extends MapElement {
  +        extends MapElement {
   
           public String path = null;
           public String[] welcomeResources = new String[0];
  @@ -1302,7 +1272,7 @@
   
   
       protected static class Wrapper
  -    extends MapElement {
  +        extends MapElement {
   
           public String path = null;
           public boolean jspWildCard = false;
  @@ -1312,280 +1282,112 @@
       // -------------------------------------------------------- Testing Methods
   
       // FIXME: Externalize this
  -
  +    /*
       public static void main(String args[]) {
   
           try {
   
  -            Mapper mapper = new Mapper();
  -            System.out.println("Start");
  -
  -            final int TEST_HOST=3;
  -
  -            String[][][] testHosts={
  -                {{"fewohfoweoih"},new String[0], {"blah9"}},
  -                {{"fwehoihoihwfeo"},new String[0], {"blah5"}},
  -                {{"iohgeoihro"},new String[0], {"blah4"}},
  -                {{"iowejoiejfoiew"},{"testalias","*.testdomain.com"}, {"blah7"}},
  -                {{"iowejoiejfoiew"},new String[0], {"blah17"}},
  -                {{"lkwefjwojweffewoih"},new String[0], {"blah11"}},
  -                {{"ohewoihfewoih"},new String[0], {"blah8"}},
  -                {{"owefojiwefoi"},new String[0], {"blah6"}},
  -                {{"qwigqwiwoih"},new String[0], {"blah14"}},
  -                {{"sjbjdvwsbvhr/"},new String[0], {"blah1"}},
  -                {{"sjbjdvwsbvhrb"},new String[0], {"blah1"}},
  -                {{"ttthtiuhwoih"},new String[0], {"blah10"}},
  -                {{"wekhfewuifweuibf"},new String[0], {"blah2"}},
  -                {{"xxxxgqwiwoih"},new String[0], {"blah13"}},
  -                {{"ylwrehirkuewh"},new String[0], {"blah3"}},
  -                {{"zzzuyopjvewpovewjhfewoih"},new String[0], {"blah12"}}
  -            };
  -
  -            for (int i=0; i < testHosts.length; i++) {
  -                mapper.addHost(testHosts[i][0][0],testHosts[i][1],testHosts[i][2][0]);
  -            }
  -
  -            System.out.println("Map:");
  -            String[] hNames=mapper.getHosts();
  -
  -            if (hNames.length!=(testHosts.length+1)) {
  -                // One of the entries was a duplicate, but it also has
  -                // two aliases, so the expected
  -                // count of hosts is +1
  -                System.out.println("***************** FAIL ********** hostCount="+hNames.length+" Expected="+(testHosts.length+1));
  -            }
  -
  -            for (int i=0; i < hNames.length; i++ ) {
  -                System.out.println(hNames[i]);
  -                if (!mapper.hostMap.contains(hNames[i])) {
  -                    System.out.println("BIG FAILURE!!!!! Host - "+hNames[i]+" doesnt appear in the hostMap!");
  -                }
  -            }
  -
  -            for (int i=0; i < testHosts.length; i++) {
  -                if (!mapper.hostMap.contains(testHosts[i][0][0])) {
  -                    System.out.println("BIG FAILURE!!!!! HostMapper doesnt appear to contain "+testHosts[i][0][0]+" in the hostMap!");
  -                }
  -            }
  -
  -            final String sDefault=testHosts[testHosts.length-2][0][0];
  -            mapper.setDefaultHostName(sDefault);
  -            if (!sDefault.equals(mapper.getDefaultHostName())) {
  -                System.out.println("***************** FAIL ********** getDefaultHostName() returned incorrect value");
  -            }
  -
  -            String[] welcomes = new String[2];
  -            welcomes[0] = "boo/baba";
  -            welcomes[1] = "bobou";
  -
  -
  -            /*
  -            Columns are
  -
  -            0   host name
  -            1   context path
  -            2   Context Name
  -            3   Welcome File List
  -            */
  -            final int CONTEXT_NAME_COL=2;
  -            final int CONTEXT_PATH_COL=1;
  -            String[][][] contextTestMap={
  -                {{testHosts[TEST_HOST][0][0]}, {""}, {"context0"}, new String[0]},
  -                {{testHosts[TEST_HOST][0][0]}, {"/foo"}, {"context1"}, new String[0]},
  -                {{testHosts[TEST_HOST][0][0]}, {"/foo/bar"}, {"context2"}, welcomes},
  -                {{testHosts[TEST_HOST][0][0]}, {"/foo/bar/ble"}, {"context3"}, new String[0]}
  -            };
  -
  -            for (int i=0; i < contextTestMap.length; i++) {
  -                mapper.addContext(contextTestMap[i][0][0],
  -                                  contextTestMap[i][1][0],
  -                                  contextTestMap[i][2][0],
  -                                  contextTestMap[i][3],
  -                                  null);
  -            }
  -
  -            /*
  -            Columns are
  -
  -                0   java.lang.Integer   Mapping into ContextTestMap
  -                1   java.lang.String    URL Mapping
  -                2   java.lang.String    Wrapper ID
  -                3   java.lang.String    Test URL
  -            */
  -
  -            final int TEST_URI_COL=3;
  -            final int WRAPPER_NAME_COL=2;
  -            final int WRAPPER_PATH_COL=1;
  -            Object[][] testWrappers={
  -                {new Integer(0),"","wrapper99","/index.html"},      
  -                {new Integer(2),"/fo/*","wrapper0","/foo/bar/fo/xxx.html"},
  -                {new Integer(2),"/fuzz/*","wrapper1","/foo/bar/fuzz/test.pdf"},
  -                {new Integer(2),"/blh","wrapper2","/foo/bar/blh"},
  -                {new Integer(2),"*.jsp","wrapper3","/foo/bar/baz.jsp"},
  -                {new Integer(2),"/blah/bou/*","wrapper4","/foo/bar/blah/bou/blech.html"},
  -                {new Integer(2),"/bla/blah/bou/*","wrapper4a","/foo/bar/bla/blah/bou/blech.html"},
  -                {new Integer(2),"/blah/bobou/*","wrapper5","/foo/bar/blah/bobou/banana.html"},
  -                {new Integer(2),"*.html","wrapper6","/foo/bar/farley.html"}
  -
  -            };
  -            for (int i=0; i < testWrappers.length; i++) {
  -                mapper.addWrapper(
  -                                 contextTestMap[((Integer)testWrappers[i][0]).intValue()][0][0],   // Server
  -                                 contextTestMap[((Integer)testWrappers[i][0]).intValue()][1][0],   // Context,
  -                                 (String)testWrappers[i][1],
  -                                 (String)testWrappers[i][2]
  -                                 );
  -            }
  -            String[] sHost=null;
  -            MappingData mappingData=new MappingData();
  -            MessageBytes uri=null ,host=null;
  -
  -            for (int iOuter=0; iOuter < 2; iOuter++) {
  -                if (iOuter==0) {
  -                    // First Pass is against the test host
  -                    sHost=testHosts[TEST_HOST][0];
  -                } else {
  -                    // 2nd pass is against an alias
  -                    sHost=testHosts[TEST_HOST][1];
  -                }
  -                host = MessageBytes.newInstance();
  -                host.setString(sHost[0]);
  -
  -                for (int iInner=0; iInner < testWrappers.length; iInner++) {
  -
  -                    uri = MessageBytes.newInstance();
  -
  -                    uri.setString((String)testWrappers[iInner][TEST_URI_COL]);
  -                    uri.toChars();
  -                    uri.getCharChunk().setLimit(-1);
  -
  -                    mapper.map(host, uri, mappingData);
  -                    //  OK, now let's check that the mapper worked.
  -                    System.out.println("Host = "+sHost[0]+" URI="+uri.toString());
  -                    System.out.println("MD Host:" + mappingData.host);
  -                    System.out.println("MD Context:" + mappingData.context);
  -                    System.out.println("MD Wrapper:" + mappingData.wrapper);
  -
  -                    System.out.println("contextPath:" + mappingData.contextPath);
  -                    System.out.println("wrapperPath:" + mappingData.wrapperPath);
  -                    System.out.println("pathInfo:" + mappingData.pathInfo);
  -                    System.out.println("redirectPath:" + mappingData.redirectPath);
  -
  -                    // Check the host name - Aliases will come back with the parent host
  -                    // name.
  -                    if (!testHosts[TEST_HOST][2][0].equals(mappingData.host)) {
  -                        System.out.println("******* FAIL host.name="+mappingData.host +" Expected="+testHosts[TEST_HOST][2][0]);
  -                    }
  -
  -                    // Check the context
  -                    if (mappingData.context!=null) {
  -                        if (!mappingData.context.equals(
  -                                                       contextTestMap[((Integer)testWrappers[iInner][0]).intValue()][CONTEXT_NAME_COL][0]
  -                                                       )
  -                           ) {
  -                        }
  -                    }
  -
  -                    if (mappingData.wrapper!=null) {
  -                        if (!mappingData.wrapper.equals(testWrappers[iInner][2])
  -                           ) {
  -                            System.out.println(" Wrappers not equal as expected - mappingData.wrapper="+mappingData.wrapper+" expected="+
  -                                               testWrappers[iInner][2]);
  -                        }
  -                    }
  -
  -                    if (mappingData.contextPath!=null) {
  -                        if (!contextTestMap[((Integer)testWrappers[iInner][0]).intValue()][CONTEXT_PATH_COL][0].equals(mappingData.contextPath.toString()
  -
  -                                                                                                                      )) {
  -                            System.out.println(" Context Path not as expected - mappingData.contextPath="+mappingData.contextPath.toString()+" expected="+
  -                                               contextTestMap[((Integer)testWrappers[iInner][0]).intValue()][CONTEXT_PATH_COL][0]);
  -                        }
  -                    }
  -
  -                    if (mappingData.wrapperPath.toString()!=null) {
  -                        if (!((String)testWrappers[iInner][WRAPPER_PATH_COL]).startsWith(mappingData.wrapperPath.toString())
  -                            && 
  -                            !((String)testWrappers[iInner][WRAPPER_PATH_COL]).startsWith("*")
  -                           ) {
  -                            System.out.println("Wrapper Path="+mappingData.wrapperPath + "  Expected="+testWrappers[iInner][WRAPPER_PATH_COL]);
  -                        }
  -                    }
  -
  -                    if (mappingData.pathInfo.toString()!=null) {
  -                        if (!
  -                            ((String)testWrappers[iInner][TEST_URI_COL]).endsWith(mappingData.pathInfo.toString())
  -                           ) {
  -                            System.out.println(" Mismatch between pathInfo ("+mappingData.pathInfo+" and Test URI ("+
  -                                               testWrappers[iInner][TEST_URI_COL]);
  -                        }
  -                    }
  -
  -                    // TODO: RedirectPath                           redirectPath:null
  -
  -                    mappingData.recycle();
  -
  -                }
  -            }
  -
  -            host = MessageBytes.newInstance();
  -            host.setString(testHosts[TEST_HOST][0][0]);
  +        Mapper mapper = new Mapper();
  +        System.out.println("Start");
   
  -            uri=MessageBytes.newInstance();
  -            uri.setString((String)testWrappers[6][TEST_URI_COL]);
  -            uri.toChars();
  -            uri.getCharChunk().setLimit(-1);
  -
  -
  -            for (int i = 0; i < 1000000; i++) {
  -                mappingData.recycle();
  -                mapper.map(host, uri, mappingData);
  -            }
  -
  -            long time = System.currentTimeMillis();
  -            for (int i = 0; i < 1000000; i++) {
  -                mappingData.recycle();
  -                mapper.map(host, uri, mappingData);
  -            }
  -
  -            System.out.println("Elapsed:" + (System.currentTimeMillis() - time));
  -            System.out.println("Host = "+host.toString()+" URI="+uri.toString());
  -            System.out.println("MD Host:" + mappingData.host);
  -            System.out.println("MD Context:" + mappingData.context);
  -            System.out.println("MD Wrapper:" + mappingData.wrapper);
  -
  -            System.out.println("contextPath:" + mappingData.contextPath);
  -            System.out.println("wrapperPath:" + mappingData.wrapperPath);
  -            System.out.println("pathInfo:" + mappingData.pathInfo);
  -            System.out.println("redirectPath:" + mappingData.redirectPath);
  -
  -            System.out.println("Testing virtual host name.");
  -
  -            host = MessageBytes.newInstance();
  -            host.setString("host99.testdomain.com");
  +        mapper.addHost("sjbjdvwsbvhrb", new String[0], "blah1");
  +        mapper.addHost("sjbjdvwsbvhr/", new String[0], "blah1");
  +        mapper.addHost("wekhfewuifweuibf", new String[0], "blah2");
  +        mapper.addHost("ylwrehirkuewh", new String[0], "blah3");
  +        mapper.addHost("iohgeoihro", new String[0], "blah4");
  +        mapper.addHost("fwehoihoihwfeo", new String[0], "blah5");
  +        mapper.addHost("owefojiwefoi", new String[0], "blah6");
  +        mapper.addHost("iowejoiejfoiew", new String[0], "blah7");
  +        mapper.addHost("iowejoiejfoiew", new String[0], "blah17");
  +        mapper.addHost("ohewoihfewoih", new String[0], "blah8");
  +        mapper.addHost("fewohfoweoih", new String[0], "blah9");
  +        mapper.addHost("ttthtiuhwoih", new String[0], "blah10");
  +        mapper.addHost("lkwefjwojweffewoih", new String[0], "blah11");
  +        mapper.addHost("zzzuyopjvewpovewjhfewoih", new String[0], "blah12");
  +        mapper.addHost("xxxxgqwiwoih", new String[0], "blah13");
  +        mapper.addHost("qwigqwiwoih", new String[0], "blah14");
  +
  +        System.out.println("Map:");
  +        for (int i = 0; i < mapper.hosts.length; i++) {
  +            System.out.println(mapper.hosts[i].name);
  +        }
  +
  +        mapper.setDefaultHostName("ylwrehirkuewh");
  +
  +        String[] welcomes = new String[2];
  +        welcomes[0] = "boo/baba";
  +        welcomes[1] = "bobou";
  +
  +        mapper.addContext("iowejoiejfoiew", "", "context0", new String[0], null);
  +        mapper.addContext("iowejoiejfoiew", "/foo", "context1", new String[0], null);
  +        mapper.addContext("iowejoiejfoiew", "/foo/bar", "context2", welcomes, null);
  +        mapper.addContext("iowejoiejfoiew", "/foo/bar/bla", "context3", new String[0], null);
  +
  +        mapper.addWrapper("iowejoiejfoiew", "/foo/bar", "/fo/*", "wrapper0");
  +        mapper.addWrapper("iowejoiejfoiew", "/foo/bar", "/", "wrapper1");
  +        mapper.addWrapper("iowejoiejfoiew", "/foo/bar", "/blh", "wrapper2");
  +        mapper.addWrapper("iowejoiejfoiew", "/foo/bar", "*.jsp", "wrapper3");
  +        mapper.addWrapper("iowejoiejfoiew", "/foo/bar", "/blah/bou/*", "wrapper4");
  +        mapper.addWrapper("iowejoiejfoiew", "/foo/bar", "/blah/bobou/*", "wrapper5");
  +        mapper.addWrapper("iowejoiejfoiew", "/foo/bar", "*.htm", "wrapper6");
  +
  +        MappingData mappingData = new MappingData();
  +        MessageBytes host = MessageBytes.newInstance();
  +        host.setString("iowejoiejfoiew");
  +        MessageBytes uri = MessageBytes.newInstance();
  +        uri.setString("/foo/bar/blah/bobou/foo");
  +        uri.toChars();
  +        uri.getCharChunk().setLimit(-1);
   
  -            uri=MessageBytes.newInstance();
  -            uri.setString((String)testWrappers[6][TEST_URI_COL]);
  -            uri.toChars();
  -            uri.getCharChunk().setLimit(-1);
  +        mapper.map(host, uri, mappingData);
  +        System.out.println("MD Host:" + mappingData.host);
  +        System.out.println("MD Context:" + mappingData.context);
  +        System.out.println("MD Wrapper:" + mappingData.wrapper);
  +
  +        System.out.println("contextPath:" + mappingData.contextPath);
  +        System.out.println("wrapperPath:" + mappingData.wrapperPath);
  +        System.out.println("pathInfo:" + mappingData.pathInfo);
  +        System.out.println("redirectPath:" + mappingData.redirectPath);
  +
  +        mappingData.recycle();
  +        mapper.map(host, uri, mappingData);
  +        System.out.println("MD Host:" + mappingData.host);
  +        System.out.println("MD Context:" + mappingData.context);
  +        System.out.println("MD Wrapper:" + mappingData.wrapper);
  +
  +        System.out.println("contextPath:" + mappingData.contextPath);
  +        System.out.println("wrapperPath:" + mappingData.wrapperPath);
  +        System.out.println("pathInfo:" + mappingData.pathInfo);
  +        System.out.println("redirectPath:" + mappingData.redirectPath);
   
  -            System.out.println("Host = "+host.toString()+" URI="+uri.toString());
  +        for (int i = 0; i < 1000000; i++) {
  +            mappingData.recycle();
  +            mapper.map(host, uri, mappingData);
  +        }
   
  +        long time = System.currentTimeMillis();
  +        for (int i = 0; i < 1000000; i++) {
               mappingData.recycle();
               mapper.map(host, uri, mappingData);
  +        }
  +        System.out.println("Elapsed:" + (System.currentTimeMillis() - time));
   
  -            System.out.println("MD Host:" + mappingData.host);
  -            System.out.println("MD Context:" + mappingData.context);
  -            System.out.println("MD Wrapper:" + mappingData.wrapper);
  -
  -            System.out.println("contextPath:" + mappingData.contextPath);
  -            System.out.println("wrapperPath:" + mappingData.wrapperPath);
  -            System.out.println("pathInfo:" + mappingData.pathInfo);
  -            System.out.println("redirectPath:" + mappingData.redirectPath);
  +        System.out.println("MD Host:" + mappingData.host);
  +        System.out.println("MD Context:" + mappingData.context);
  +        System.out.println("MD Wrapper:" + mappingData.wrapper);
  +
  +        System.out.println("contextPath:" + mappingData.contextPath);
  +        System.out.println("wrapperPath:" + mappingData.wrapperPath);
  +        System.out.println("requestPath:" + mappingData.requestPath);
  +        System.out.println("pathInfo:" + mappingData.pathInfo);
  +        System.out.println("redirectPath:" + mappingData.redirectPath);
   
           } catch (Exception e) {
               e.printStackTrace();
           }
   
       }
  +    */
  +
  +
   }
  
  
  
  1.313     +0 -5      jakarta-tomcat-catalina/webapps/docs/changelog.xml
  
  Index: changelog.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
  retrieving revision 1.312
  retrieving revision 1.313
  diff -u -r1.312 -r1.313
  --- changelog.xml	4 Jun 2005 12:33:38 -0000	1.312
  +++ changelog.xml	4 Jun 2005 17:34:23 -0000	1.313
  @@ -72,11 +72,6 @@
     
     <subsection name="Catalina">
       <changelog>
  -      <add>
  -        Support Host Alias matching with Connector attribute allowedAliasMatches="max alias".
  -        So we can easier integrate subdomain as host alias &lt;Alias&gt;*.mydomain.net"&lt;/Alias&gt;.
  -        Submitted by George Sexton (pero)
  -      </add>
         <fix>
           <bug>20380</bug>: Access log timestamps now take account of Daylight Saving
           Time (DST). (markt)
  
  
  

---------------------------------------------------------------------
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