costin      2002/10/30 16:56:36

  Modified:    jk/java/org/apache/jk/server JkMain.java
  Log:
  Added support for coyote properties and 'shortcuts'.
  
  This should solve a number of problems where information
  was not passed from server.xml to jk.
  
  Long term we should just consolidate all the config - but that'll
  take a bit more time.
  
  PR: 12686
  
  Revision  Changes    Path
  1.31      +36 -1     
jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkMain.java
  
  Index: JkMain.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkMain.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- JkMain.java       3 Oct 2002 19:31:31 -0000       1.30
  +++ JkMain.java       31 Oct 2002 00:56:35 -0000      1.31
  @@ -451,8 +451,44 @@
               ex.printStackTrace();
           }
       }
  +
  +    // translate top-level keys ( from coyote or generic ) into component keys
  +    static Hashtable replacements=new Hashtable();
  +    static {
  +        replacements.put("port","channelSocket.port");
  +        replacements.put("maxThreads", "channelSocket.maxThreads");   
  +        replacements.put("backlog", "channelSocket.backlog");   
  +        replacements.put("tcpNoDelay", "channelSocket.tcpNoDelay");
  +        replacements.put("soTimeout", "channelSocket.soTimeout");
  +        replacements.put("timeout", "channelSocket.timeout");
  +        replacements.put("address", "channelSocket.address");            
  +    }
  +
  +    private void preProcessProperties() {
  +        Enumeration keys=props.keys();
  +        Vector v=new Vector();
  +        
  +        while( keys.hasMoreElements() ) {
  +            String key=(String)keys.nextElement();          
  +            Object newName=replacements.get(key);
  +            if( newName !=null ) {
  +                v.addElement(key);
  +            }
  +        }
  +        keys=v.elements();
  +        while( keys.hasMoreElements() ) {
  +            String key=(String)keys.nextElement();
  +            Object propValue=props.getProperty( key );
  +            String replacement=(String)replacements.get(key);
  +            props.put(replacement, propValue);
  +            if( log.isDebugEnabled()) 
  +                log.debug("Substituting " + key + " " + replacement + " " + 
  +                    propValue);
  +        }
  +    }
       
       private void processProperties() {
  +        preProcessProperties();
           Enumeration keys=props.keys();
   
           while( keys.hasMoreElements() ) {
  @@ -480,7 +516,6 @@
               }
               propName=name.substring( lastDot+1);
           } else {
  -            // No . -> global property, will be used in substitutions
               return;
           }
           
  
  
  

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

Reply via email to