cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
billbarker2004/05/26 21:42:13 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Quote the module name passed to LoadModule. Revision ChangesPath 1.33 +4 -4 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- ApacheConfig.java 25 Feb 2004 07:06:59 - 1.32 +++ ApacheConfig.java 27 May 2004 04:42:13 - 1.33 @@ -336,8 +336,8 @@ // Verify the file exists !! mod_jk.println(IfModule !mod_jk.c); - mod_jk.println( LoadModule jk_module + -modJk.toString().replace('\\','/')); + mod_jk.println( LoadModule jk_module \+ +modJk.toString().replace('\\','/')+\); mod_jk.println(/IfModule); mod_jk.println(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java JservConfig.java NSConfig.java TrustedLoader.java
costin 01/12/16 21:24:09 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java JservConfig.java NSConfig.java TrustedLoader.java Log: Another gcj change ( result of my old experiment to compile tomcat to native code ). We have a final string that will be set later - in theory it should be ok, as it's set only once ( again my understanding of JLS ). Revision ChangesPath 1.30 +3 -3 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- ApacheConfig.java 2001/12/17 02:30:48 1.29 +++ ApacheConfig.java 2001/12/17 05:24:09 1.30 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.29 2001/12/17 02:30:48 larryi Exp $ +/* $Id: ApacheConfig.java,v 1.30 2001/12/17 05:24:09 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -149,7 +149,7 @@ @author Costin Manolache @author Larry Isaacs @author Mel Martinez - @version $Revision: 1.29 $ $Date: 2001/12/17 02:30:48 $ + @version $Revision: 1.30 $ $Date: 2001/12/17 05:24:09 $ */ public class ApacheConfig extends BaseJkConfig { @@ -162,7 +162,7 @@ /** default mod_jk log file location */ public static final String JK_LOG_LOCATION = logs/mod_jk.log; /** default location of mod_jk Apache plug-in. */ -public static final String MOD_JK; +public static String MOD_JK; //set up some defaults based on OS type static{ 1.5 +2 -2 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/JservConfig.java Index: JservConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/JservConfig.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- JservConfig.java 2001/08/19 22:47:04 1.4 +++ JservConfig.java 2001/12/17 05:24:09 1.5 @@ -122,7 +122,7 @@ @author Costin Manolache @author Larry Isaacs @author Mel Martinez -@version $Revision: 1.4 $ $Date: 2001/08/19 22:47:04 $ +@version $Revision: 1.5 $ $Date: 2001/12/17 05:24:09 $ */ public class JservConfig extends BaseInterceptor { @@ -131,7 +131,7 @@ /** default mod_jserv log file location */ public static final String JSERV_LOG_LOCATION = logs/mod_jserv.log; /** default location of mod_jserv Apache plug-in. */ -public static final String MOD_JSERV; +public static String MOD_JSERV; public static final String AJPV12=ajpv12; //set up some defaults based on OS type 1.9 +2 -2 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/NSConfig.java Index: NSConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/NSConfig.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- NSConfig.java 2001/12/17 02:30:48 1.8 +++ NSConfig.java 2001/12/17 05:24:09 1.9 @@ -133,7 +133,7 @@ @author Costin Manolache @author Larry Isaacs @author Gal Shachor - @version $Revision: 1.8 $ + @version $Revision: 1.9 $ */ public class NSConfig extends BaseJkConfig { @@ -141,7 +141,7 @@ public static final String NS_CONFIG = /conf/auto/obj.conf; public static final String NSAPI_LOG_LOCATION = /logs/nsapi_redirect.log; /** default location of nsapi plug-in. */ -public static final String NSAPI_REDIRECTOR; +public static String NSAPI_REDIRECTOR; //set up some defaults based on OS type static{ 1.4 +9 -1 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/TrustedLoader.java Index: TrustedLoader.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/TrustedLoader.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TrustedLoader.java2001/07/29 00:45:53 1.3 +++ TrustedLoader.java2001/12/17 05:24:09 1.4 @@ -107,6 +107,7 @@ { if( state!=ContextManager.STATE_CONFIG ) return; + if( debug0 ) log(TrustedLoader: + state ); Enumeration ctxsE= cm.getContexts(); while( ctxsE.hasMoreElements() ) { Context context=(Context)ctxsE.nextElement(); @@ -133,12 +134,15 @@
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
larryi 01/08/16 20:53:24 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Update to make all contexts for a virtual host appear within a single Virtual Host block. For a root context in a virtual host, set DocumentRoot instead of a using Alias / For a root context outside of a virtual host, supply an appropriate message about DocumentRoot. Can't override the one in httpd.conf. Revision ChangesPath 1.26 +86 -60 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- ApacheConfig.java 2001/08/16 05:22:41 1.25 +++ ApacheConfig.java 2001/08/17 03:53:24 1.26 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.25 2001/08/16 05:22:41 larryi Exp $ +/* $Id: ApacheConfig.java,v 1.26 2001/08/17 03:53:24 larryi Exp $ * * * The Apache Software License, Version 1.1 @@ -146,7 +146,7 @@ @author Costin Manolache @author Larry Isaacs @author Mel Martinez - @version $Revision: 1.25 $ $Date: 2001/08/16 05:22:41 $ + @version $Revision: 1.26 $ $Date: 2001/08/17 03:53:24 $ */ public class ApacheConfig extends BaseJkConfig { @@ -293,17 +293,44 @@ // XXX Make those options configurable in server.xml generateSSLConfig( mod_jk ); +Hashtable vhosts = new Hashtable(); + // Set up contexts // XXX deal with Virtual host configuration Enumeration enum = cm.getContexts(); while (enum.hasMoreElements()) { Context context = (Context)enum.nextElement(); - if( forwardAll ) - generateStupidMappings( context, mod_jk ); - else - generateContextMappings( context, mod_jk ); +String host = context.getHost(); +if( host == null ) { +if( forwardAll ) +generateStupidMappings( context, mod_jk ); +else +generateContextMappings( context, mod_jk ); +} else { +Vector vhostContexts = (Vector)vhosts.get(host); +if ( vhostContexts == null ) { +vhostContexts = new Vector(); +vhosts.put(host,vhostContexts); +} +vhostContexts.addElement(context); +} } +enum = vhosts.elements(); +while( enum.hasMoreElements() ) { +Vector vhostContexts = (Vector)enum.nextElement(); +for( int i = 0; i vhostContexts.size(); i++ ) { +Context context = (Context)vhostContexts.elementAt(i); +if( i == 0 ) +generateVhostHead( context, mod_jk ); +if( forwardAll ) +generateStupidMappings( context, mod_jk ); +else +generateContextMappings( context, mod_jk ); +} +generateVhostTail( mod_jk ); +} + mod_jk.close(); } catch( Exception ex ) { Log loghelper = Log.getLog(tc_log, this); @@ -367,6 +394,32 @@ } return true; } + +private void generateVhostHead(Context context, PrintWriter mod_jk) { + String ctxPath = context.getPath(); + String vhost = context.getHost(); + +mod_jk.println(); +String vhostip = getVirtualHostAddress(vhost, +context.getHostAddress()); +generateNameVirtualHost(mod_jk, vhostip); +mod_jk.println(VirtualHost + vhostip + ); +mod_jk.println(ServerName + vhost ); +Enumeration aliases=context.getHostAliases(); +if( aliases.hasMoreElements() ) { +mod_jk.print(ServerAlias ); +while( aliases.hasMoreElements() ) { +mod_jk.print( (String)aliases.nextElement() + ); +} +mod_jk.println(); +} +indent=; +} + +private void generateVhostTail(PrintWriter mod_jk) { +mod_jk.println(/VirtualHost); +indent=; +} private void generateSSLConfig(PrintWriter mod_jk) { if( ! sslExtract ) { @@ -405,36 +458,23 @@ log(Ignoring root context in forward-all mode ); return; } - if( vhost !=
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/08/15 17:27:07 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Added 'inprocess' to the list of jkProtocols. Revision ChangesPath 1.24 +3 -3 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- ApacheConfig.java 2001/08/11 03:37:28 1.23 +++ ApacheConfig.java 2001/08/16 00:27:07 1.24 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.23 2001/08/11 03:37:28 larryi Exp $ +/* $Id: ApacheConfig.java,v 1.24 2001/08/16 00:27:07 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -118,7 +118,7 @@ libjkLog/b - path to log file to be used by mod_jk./li libjkDebug/b - JK Loglevel setting. May be debug, info, error, or emerg. If not set, defaults to emerg./li - libjkProtocol/b The desired protocal, ajp12 or ajp13. If not + libjkProtocol/b The desired protocal, ajp12 or ajp13 or inprocess. If not specified, defaults to ajp13 if an Ajp13Interceptor is in use, otherwise it defaults to ajp12./li libforwardAll/b - If true, forward all requests to Tomcat. This helps @@ -146,7 +146,7 @@ @author Costin Manolache @author Larry Isaacs @author Mel Martinez - @version $Revision: 1.23 $ $Date: 2001/08/11 03:37:28 $ + @version $Revision: 1.24 $ $Date: 2001/08/16 00:27:07 $ */ public class ApacheConfig extends BaseJkConfig {
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
larryi 01/08/15 22:22:41 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Update to avoid writing duplicate NameVirtualHost directives. Also, if the context's host name is an ip address, or a host ip address is specified, then that address is used for the NameVirtualHost and VirtualHost directives. Added generation of NameVirtualHost to generateContextMappings(). Revision ChangesPath 1.25 +32 -8 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- ApacheConfig.java 2001/08/16 00:27:07 1.24 +++ ApacheConfig.java 2001/08/16 05:22:41 1.25 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.24 2001/08/16 00:27:07 costin Exp $ +/* $Id: ApacheConfig.java,v 1.25 2001/08/16 05:22:41 larryi Exp $ * * * The Apache Software License, Version 1.1 @@ -146,7 +146,7 @@ @author Costin Manolache @author Larry Isaacs @author Mel Martinez - @version $Revision: 1.24 $ $Date: 2001/08/16 00:27:07 $ + @version $Revision: 1.25 $ $Date: 2001/08/16 05:22:41 $ */ public class ApacheConfig extends BaseJkConfig { @@ -182,6 +182,8 @@ private String sslSessionIndicator=SSL_SESSION_ID; private String sslCipherIndicator=SSL_CIPHER; private String sslCertsIndicator=SSL_CLIENT_CERT; + +Hashtable NamedVirtualHosts=null; public ApacheConfig() { } @@ -254,7 +256,7 @@ */ protected void initProperties(ContextManager cm) { super.initProperties(cm); - + jkConfig=FileUtil.getConfigFile( jkConfig, configHome, MOD_JK_CONFIG); workersConfig=FileUtil.getConfigFile( workersConfig, configHome, WORKERS_CONFIG); @@ -280,6 +282,8 @@ initProperties(cm); initProtocol(cm); +NamedVirtualHosts = new Hashtable(); + StringBuffer sb=new StringBuffer(); PrintWriter mod_jk = new PrintWriter(new FileWriter(jkConfig)); log(Generating apache mod_jk config = +jkConfig ); @@ -402,8 +406,10 @@ return; } if( vhost != null ) { - generateNameVirtualHost(mod_jk ); - mod_jk.println(VirtualHost *); +String vhostip = getVirtualHostAddress(vhost, +context.getHostAddress()); + generateNameVirtualHost(mod_jk, vhostip); + mod_jk.println(VirtualHost + vhostip + ); mod_jk.println(ServerName + vhost ); Enumeration aliases=context.getHostAliases(); if( aliases.hasMoreElements() ) { @@ -426,13 +432,17 @@ mod_jk.println(indent + JkMount + nPath + /* + jkProto ); if( vhost != null ) { mod_jk.println(/VirtualHost); +mod_jk.println(); indent=; } } -private void generateNameVirtualHost( PrintWriter mod_jk ) { - mod_jk.println(NameVirtualHost *); +private void generateNameVirtualHost( PrintWriter mod_jk, String ip ) { +if( !NamedVirtualHosts.containsKey(ip) ) { +mod_jk.println(NameVirtualHost + ip + ); +NamedVirtualHosts.put(ip,ip); +} } // Apache serves static mode @@ -454,7 +464,10 @@ ); mod_jk.println(); if( vhost != null ) { - mod_jk.println(VirtualHost *); +String vhostip = getVirtualHostAddress(vhost, +context.getHostAddress()); + generateNameVirtualHost(mod_jk, vhostip); + mod_jk.println(VirtualHost + vhostip + ); mod_jk.println(ServerName + vhost ); Enumeration aliases=context.getHostAliases(); if( aliases.hasMoreElements() ) { @@ -614,4 +627,15 @@ } return docBase; } + +private String getVirtualHostAddress(String vhost, String vhostip) { +if( vhostip == null ) { +if ( vhost != null vhost.length() 0 Character.isDigit(vhost.charAt(0)) ) +vhostip=vhost; +else +vhostip=*; +} +return vhostip; +} + }
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
larryi 01/08/02 03:33:02 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Addresses problem with using an Alias directive with the root context. Reported by: William Barker The noRoot parameter now works with forwardAll false too. If noRoot is false, an Alias directive is no longer included for the root context. An Alias / ... directive appears to interfere with Alias directives for other contexts. Instead a message is included indicating that Apache's DocumentRoot setting must be updated. Also, a similar message is included for noRoot false and forwardAll true since some static resources will still come from Apache's root unless it is changed. Also made some other minor changes such as updating the javadoc and changed a log message to require debug 0. Revision ChangesPath 1.20 +69 -32 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ApacheConfig.java 2001/07/20 18:46:04 1.19 +++ ApacheConfig.java 2001/08/02 10:33:02 1.20 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.19 2001/07/20 18:46:04 costin Exp $ +/* $Id: ApacheConfig.java,v 1.20 2001/08/02 10:33:02 larryi Exp $ * * * The Apache Software License, Version 1.1 @@ -110,7 +110,7 @@ If not set, this defaults to TOMCAT_HOME. Ignored whenever any of the following paths is absolute. /li - libjkConfig/b - path to write apacke mod_jk conf file to. If + libjkConfig/b - path to use for writing Apache mod_jk conf file. If not set, defaults to conf/jk/mod_jk.conf./li libworkersConfig/b - path to workers.properties file used by @@ -121,23 +121,36 @@ modules/mod_jk.nlm on netware, and libexec/mod_jk.so everywhere else./li libjkLog/b - path to log file to be used by mod_jk./li - libforwardAll/b - If true, forward all requests to Tomcat. IF - false, let Apache serve static resources. + libjkDebug/b - JK Loglevel setting. May be debug, info, error, or emerg. + If not set, defaults to no log./li + libjkProtocol/b The desired protocal, ajp12 or ajp13. If not + specified, defaults to ajp13 if an Ajp13Interceptor + is in use, otherwise it defaults to ajp12./li + libforwardAll/b - If true, forward all requests to Tomcat. This helps + insure that all the behavior configured in the web.xml + file functions correctly. If false, let Apache serve + static resources. The default is true. Warning: When false, some configuration in the web.xml may not be duplicated in Apache. - Review the mod_jk.conf file to see what + Review the mod_jk conf file to see what configuration is actually being set in Apache./li - libjkDebug/b - JK Loglevel setting. May be debug, info, error, or emerg. - If not set, defaults to no log./li libnoRoot/b - If true, the root context is not mapped to - Tomcat. If false, Tomcat services all requests - to the root context. The default is true. - This setting only applies if forwardAll is true./li + Tomcat. If false and forwardAll is true, all requests + to the root context are mapped to Tomcat. If false and + forwardAll is false, only JSP and servlets requests to + the root context are mapped to Tomcat. When false, + to correctly serve Tomcat's root context you must also + modify the DocumentRoot setting in Apache's httpd.conf + file to point to Tomcat's root context directory. + Otherwise some content, such as Apache's index.html, + will be served by Apache before mod_jk gets a chance + to claim the request and pass it to Tomcat. + The default is true./li /ul p @author Costin Manolache @author Mel Martinez -
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
larryi 01/07/20 05:45:20 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Modified handling when forwardAll is true and using JkMount to also include the context pattern, i.e. /ctx/*. Just /ctx defines an exact match only. Made noRoot default to true. JkMount doesn't seem to be able to steal /index.html from Apache, so noRoot=false doesn't completely work with JkMount which is the default. Locate with setHandler can get all the requests, but setHandler doesn't currently work because mod_jk's jk_handler() gets called without a worker name being set. This means that useJkMount=false and forwardAll=false shouldn't be used until this is fixed. Updated the javadoc. Revision ChangesPath 1.18 +37 -16 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- ApacheConfig.java 2001/07/16 00:00:41 1.17 +++ ApacheConfig.java 2001/07/20 12:45:20 1.18 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.17 2001/07/16 00:00:41 costin Exp $ +/* $Id: ApacheConfig.java,v 1.18 2001/07/20 12:45:20 larryi Exp $ * * * The Apache Software License, Version 1.1 @@ -95,7 +95,7 @@ initialized during startup. p This config interceptor is enabled by inserting an ApacheConfig -element in the b\ContextManager/b tag body inside +element in the blt;ContextManagergt;/b tag body inside the server.xml file like so: pre * ContextManager ... @@ -106,26 +106,41 @@ /pre where ioptions/i can include any of the following attributes: ul - libconfighome/b - default parent directory for the following paths. + libconfigHome/b - default parent directory for the following paths. If not set, this defaults to TOMCAT_HOME. Ignored whenever any of the following paths is absolute. /li - libjkconfig/b - path to write apacke mod_jk conf file to. If + libjkConfig/b - path to write apacke mod_jk conf file to. If not set, defaults to conf/jk/mod_jk.conf./li - libworkersconfig/b - path to workers.properties file used by + libworkersConfig/b - path to workers.properties file used by mod_jk. If not set, defaults to conf/jk/workers.properties./li - libmodjk/b - path to Apache mod_jk plugin file. If not set, + libmodJk/b - path to Apache mod_jk plugin file. If not set, defaults to modules/mod_jk.dll on windows, modules/mod_jk.nlm on netware, and libexec/mod_jk.so everywhere else./li - libjklog/b - path to log file to be used by mod_jk./li + libjkLog/b - path to log file to be used by mod_jk./li + libforwardAll/b - If true, forward all requests to Tomcat. IF + false, let Apache serve static resources. + Warning: When false, some configuration in + the web.xml may not be duplicated in Apache. + Review the mod_jk.conf file to see what + configuration is actually being set in Apache./li + libuseJkMount/b - If true, use JkMount mount directives. If false, + lt;Locationgt; and SetHandler directives are used. + the default is true./li + libjkDebug/b - JK Loglevel setting. May be debug, info, error, or emerg. + If not set, defaults to no log./li + libnoRoot/b - If true, the root context is not mapped to + Tomcat. If false, Tomcat services all requests + to the root context. The default is true. + This setting only applies if forwardAll is true./li /ul p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.17 $ $Date: 2001/07/16 00:00:41 $ + @version $Revision: 1.18 $ $Date: 2001/07/20 12:45:20 $ */ public class ApacheConfig extends BaseInterceptor { @@ -168,7 +183,7 @@ private String jkDebug=null; -private boolean noRoot=false; +private boolean noRoot=true; // ssl settings private boolean sslExtract=true; @@ -230,11 +245,13 @@ } /** Special option - do
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/07/20 11:46:04 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Remove the SetHandler option. This is new code, and will probably be available with all the new features and ajp14 as part of j-t-c. There is no need to put it into the official 3.3 beta/release - people who need this feature will be better served by a standalone module, as this is likely to evolve in the future ( as oposed to the 3.3 main codebase, which is supposed to remain freezed - so we can focus on features and modules knowing the base is stable and it's not going to change ) The current autoconfiguration mechanism in 3.3 ( using JkMount ) should work as well ( or better ) than before, with either the old mod_jk or the new one. Revision ChangesPath 1.19 +10 -36 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ApacheConfig.java 2001/07/20 12:45:20 1.18 +++ ApacheConfig.java 2001/07/20 18:46:04 1.19 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.18 2001/07/20 12:45:20 larryi Exp $ +/* $Id: ApacheConfig.java,v 1.19 2001/07/20 18:46:04 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -127,9 +127,6 @@ the web.xml may not be duplicated in Apache. Review the mod_jk.conf file to see what configuration is actually being set in Apache./li - libuseJkMount/b - If true, use JkMount mount directives. If false, - lt;Locationgt; and SetHandler directives are used. - the default is true./li libjkDebug/b - JK Loglevel setting. May be debug, info, error, or emerg. If not set, defaults to no log./li libnoRoot/b - If true, the root context is not mapped to @@ -140,7 +137,7 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.18 $ $Date: 2001/07/20 12:45:20 $ + @version $Revision: 1.19 $ $Date: 2001/07/20 18:46:04 $ */ public class ApacheConfig extends BaseInterceptor { @@ -237,13 +234,6 @@ forwardAll=b; } -/** Use JkMount directives ( default ) or Location - and SetHandler ( if false ) -*/ -public void setUseJkMount( boolean b ) { - useJkMount=b; -} - /** Special option - do not generate mappings for the ROOT context. The default is true, and will not generate the mappings, not redirecting all pages to tomcat (since /* matches everything). @@ -579,17 +569,11 @@ log(Ignoring root context in mount-all mode ); return true; } - if( useJkMount ) { - mod_jk.println(indent + JkMount + nPath + + jkProto ); -if( .equals(ctxPath) ) -mod_jk.println(indent + JkMount + nPath + * + jkProto ); -else -mod_jk.println(indent + JkMount + nPath + /* + jkProto ); - } else { - mod_jk.println(indent + Location \ + nPath + \); - mod_jk.println(indent + SetHandler jakarta-servlet); - mod_jk.println(indent + /Location); - } + mod_jk.println(indent + JkMount + nPath + + jkProto ); + if( .equals(ctxPath) ) + mod_jk.println(indent + JkMount + nPath + * + jkProto ); + else + mod_jk.println(indent + JkMount + nPath + /* + jkProto ); if( vhost != null ) { mod_jk.println(/VirtualHost); indent=; @@ -685,25 +669,15 @@ private boolean addExtensionMapping( String ctxPath, String ext, PrintWriter mod_jk ) { - mod_jk.println(indent + LocationMatch + ctxPath + /(.*/)*.*\\. + -ext + ); - mod_jk.println(indent + SetHandler jakarta-servlet ); - mod_jk.println(indent + /LocationMatch); + mod_jk.println(indent + JkMount + ctxPath + /*. + ext ++ + jkProto); return true; } private boolean addMapping( String fullPath, PrintWriter mod_jk ) { log( Adding map for + fullPath ); - if( useJkMount ) { - mod_jk.println(indent + JkMount + fullPath ++ jkProto ); - } else { - mod_jk.println(indent + Location + fullPath + ); - mod_jk.println(indent + SetHandler jakarta-servlet ); - // XXX Other nice things like setting servlet and other
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/07/15 17:00:42 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Remove the ending / from Alias ( it's not used in the default config, only when you want static files served by apache ) Revision ChangesPath 1.17 +3 -3 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ApacheConfig.java 2001/07/13 06:13:56 1.16 +++ ApacheConfig.java 2001/07/16 00:00:41 1.17 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.16 2001/07/13 06:13:56 costin Exp $ +/* $Id: ApacheConfig.java,v 1.17 2001/07/16 00:00:41 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -125,7 +125,7 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.16 $ $Date: 2001/07/13 06:13:56 $ + @version $Revision: 1.17 $ $Date: 2001/07/16 00:00:41 $ */ public class ApacheConfig extends BaseInterceptor { @@ -718,7 +718,7 @@ String npath=(.equals(ctxPath)) ? / : ctxPath; // Static files will be served by Apache mod_jk.println(indent + # Static files ); - mod_jk.println(indent + Alias + npath + \ + docBase + \/); + mod_jk.println(indent + Alias + npath + \ + docBase + \); mod_jk.println(); mod_jk.println(indent + Directory \ + docBase + \); mod_jk.println(indent + Options Indexes FollowSymLinks);
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/07/12 23:13:59 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: One more improvement in the generated config. As mentioned, the default is the stupid mode where all requrest are forwarded to tomcat. There is nothing we can do about this, web.xml doesn't match what Apache can normally do. However, for some contexts where only basic web.xml settings are used we can generate a good configuration for Apache that will use entirely the native apache modules ( with no double mapping - previously mod_jk and mod_jserv did a second parsing/matching on requests, in translate, reducing the peformance for all requests ). We now use SetHandler to triger the tomcat forwarding ( thanks Dirk for giving the idea ). That means people with Apache background can easily hack some optimized configurations for their sites. For virtual hosts we can generate the right VirtualHost , ServerName, ServerAliases - it should work fine for name-based virtual hosts ( but you'll need manual tuning for IP-based vhosts ). As I mentioned, this all extra efforts is spent to allow people to tune their servers and get maximum performance. By default we'll just generate JkMount which forwards all requests, that should solve most questions about how to configure. Of course, Ajp14 can make few more steps, but I think the current ApacheConfig is a good enough progress for 3.3. Revision ChangesPath 1.16 +310 -155 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- ApacheConfig.java 2001/07/04 05:09:56 1.15 +++ ApacheConfig.java 2001/07/13 06:13:56 1.16 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.15 2001/07/04 05:09:56 costin Exp $ +/* $Id: ApacheConfig.java,v 1.16 2001/07/13 06:13:56 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -69,6 +69,26 @@ import org.apache.tomcat.modules.server.Ajp12Interceptor; import org.apache.tomcat.modules.server.Ajp13Interceptor; +/* The idea is to keep all configuration in server.xml and + the normal apache config files. We don't want people to + touch apache ( or IIS, NES ) config files unless they + want to and know what they're doing ( better than we do :-). + + One nice feature ( if someone sends it ) would be to + also edit httpd.conf to add the include. + + We'll generate a number of configuration files - this one + is trying to generate a native apache config file. + + Some web.xml mappings do not map to server configuration - in + this case we need to fallback to forward all requests to tomcat. + + Ajp14 will add to that the posibility to have tomcat and + apache on different machines, and many other improvements - + but this should also work for Ajp12, Ajp13 and Jni. + +*/ + /** Generates automatic apache configurations based on the Tomcat server.xml settings and the war contexts @@ -105,14 +125,16 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.15 $ $Date: 2001/07/04 05:09:56 $ + @version $Revision: 1.16 $ $Date: 2001/07/13 06:13:56 $ */ public class ApacheConfig extends BaseInterceptor { /** default path to mod_jk .conf location */ public static final String MOD_JK_CONFIG = conf/auto/mod_jk.conf; -/** default path to workers.properties file */ -public static final String WORKERS_CONFIG = conf/auto/workers.properties; +/** default path to workers.properties file + This should be also auto-generated from server.xml. +*/ +public static final String WORKERS_CONFIG = conf/jk/workers.properties; /** default mod_jk log file location */ public static final String JK_LOG_LOCATION = logs/mod_jk.log; /** default location of mod_jk Apache plug-in. */ @@ -145,6 +167,15 @@ private boolean useJkMount=true; private String jkDebug=null; + +private boolean noRoot=false; + +// ssl settings +private boolean sslExtract=true; +private String sslHttpsIndicator=HTTPS; +private String sslSessionIndicator=SSL_SESSION_ID; +private String sslCipherIndicator=SSL_CIPHER; +private String sslCertsIndicator=SSL_CLIENT_CERT; // default is true until we can map all web.xml directives // Or detect only portable directives were used. @@ -197,6 +228,17 @@ public void setUseJkMount( boolean b ) { useJkMount=b; } + +/** Special option - do not
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/07/03 16:32:28 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Removed the jserv configuration part, reorganize a bit the code. The context mappings will be generated only of the user explicitely asks that, by default we'll forward all requests to tomcat, including static files ( since not all web.xml can be mapped to apache configs ). Later we can detect if web.xml can be mapped and generate native mappings for those contexts, and when mod_jk will finish duplicating the mapper we can generate uri_worker_map file. The second part will probably go in a UriMap.java file that will be shared for all servers, ApacheConfig will still generate apache-specific configuration. Revision ChangesPath 1.12 +305 -629 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- ApacheConfig.java 2001/06/21 13:04:19 1.11 +++ ApacheConfig.java 2001/07/03 23:32:26 1.12 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.11 2001/06/21 13:04:19 larryi Exp $ +/* $Id: ApacheConfig.java,v 1.12 2001/07/03 23:32:26 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -90,19 +90,12 @@ If not set, this defaults to TOMCAT_HOME. Ignored whenever any of the following paths is absolute. /li - libjservconfig/b - path to write apache jserv conf file to. If - not set, defaults to - conf/jserv/tomcat-apache.conf./li libjkconfig/b - path to write apacke mod_jk conf file to. If not set, defaults to conf/jk/mod_jk.conf./li libworkersconfig/b - path to workers.properties file used by mod_jk. If not set, defaults to conf/jk/workers.properties./li - libmodjserv/b - path to Apache JServ plugin module file. If not - set, defaults to modules/ApacheModuleJServ.dll - on windows, modules/Jserv.nlm on netware, and - libexec/mod_jserv.so everywhere else./li libmodjk/b - path to Apache mod_jk plugin file. If not set, defaults to modules/mod_jk.dll on windows, modules/mod_jk.nlm on netware, and @@ -112,20 +105,16 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.11 $ $Date: 2001/06/21 13:04:19 $ + @version $Revision: 1.12 $ $Date: 2001/07/03 23:32:26 $ */ public class ApacheConfig extends BaseInterceptor { -/** default path to JServ .conf location */ -public static final String APACHE_CONFIG=conf/jserv/tomcat-apache.conf; /** default path to mod_jk .conf location */ public static final String MOD_JK_CONFIG = conf/jk/mod_jk.conf; /** default path to workers.properties file */ public static final String WORKERS_CONFIG = conf/jk/workers.properties; /** default mod_jk log file location */ public static final String JK_LOG_LOCATION = logs/mod_jk.log; -/** default location of mod_jserv Apache plug-in. */ -public static final String MOD_JSERV; /** default location of mod_jk Apache plug-in. */ public static final String MOD_JK; @@ -133,43 +122,38 @@ static{ String os = System.getProperty(os.name).toLowerCase(); if(os.indexOf(windows)=0){ - MOD_JSERV = modules/ApacheModuleJserv.dll; MOD_JK = modules/mod_jk.dll; }else if(os.indexOf(netware)=0){ - MOD_JSERV = modules/Jserv.nlm; MOD_JK = modules/mod_jk.nlm; }else{ - MOD_JSERV = libexec/mod_jserv.so; MOD_JK = libexec/mod_jk.so; } } -public static final String[] JkMount = { ajp12, ajp13 }; -public static final int AJP12 = 0; -public static final int AJP13 = 1; -public static final String AJPV12 = ajpv12; public static final String JTC_AJP13_INTERCEPTOR = org.apache.ajp.tomcat33.Ajp13Interceptor; - private File configHome = null; -private File jservConfig = null; private File jkConfig = null; private File workersConfig = null; -private File modJserv = null; private File modJk = null; private File jkLog = null; - -private int jkProtocol = -1; +
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/07/03 16:50:33 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Added the code to generate simple/stupid mappings, a bit of reorganization in the code that lets apache serve static files. We can easily generate apache rules to map all the servlet mappings, including security constraints, and we can also detect apps using other configs - and do the stupid thing only for those. I think welcome files could be handled, same for error pages and mime types ( at least apache2.0 seems to support that). It'll be hard/imposible on NES and IIS, but there's nothing we can do about it ( well, even for those we can map some contexts and we can use manual mode for those using non-mappable web.xml options ) . Revision ChangesPath 1.13 +96 -77 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ApacheConfig.java 2001/07/03 23:32:26 1.12 +++ ApacheConfig.java 2001/07/03 23:50:32 1.13 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.12 2001/07/03 23:32:26 costin Exp $ +/* $Id: ApacheConfig.java,v 1.13 2001/07/03 23:50:32 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -105,7 +105,7 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.12 $ $Date: 2001/07/03 23:32:26 $ + @version $Revision: 1.13 $ $Date: 2001/07/03 23:50:32 $ */ public class ApacheConfig extends BaseInterceptor { @@ -347,7 +347,10 @@ Enumeration enum = cm.getContexts(); while (enum.hasMoreElements()) { Context context = (Context)enum.nextElement(); - generateContextMappings( context, mod_jk ); + if( forwardAll ) + generateStupidMappings( context, mod_jk ); + else + generateContextMappings( context, mod_jk ); } mod_jk.close(); @@ -435,46 +438,51 @@ mod_jk.println(); } -private void generateContextMappings(Context context, PrintWriter mod_jk ) { +/** Forward all requests for a context to tomcat. + The default. + */ +private void generateStupidMappings(Context context, PrintWriter mod_jk ) { String path = context.getPath(); String vhost = context.getHost(); if( vhost != null ) { // Generate Apache VirtualHost section for this host // You'll have to do it manually right now - // XXX return; } if( path.length() 1) { - // It's not the root context - // assert path.startsWith( / ) - - // Calculate the absolute path of the document base - String docBase = context.getDocBase(); - if (!FileUtil.isAbsolute(docBase)){ - docBase = tomcatHome + / + docBase; - } - docBase = FileUtil.patch(docBase); - if (File.separatorChar == '\\') - docBase = docBase.replace('\\','/');// use separator preferred by Apache + mod_jk.println(Location \ + path + \); + mod_jk.println(SetHandler jakarta-servlet); + mod_jk.println(/Location); + } else { + // the root context + // XXX If tomcat has a root context it should get all requests + // - which means apache will have absolutely nothing to do except + // forwarding requests. + + // We should at least try to see if the root context has + // a mappable configuration and generate a smart mapping - // Static files will be served by Apache - mod_jk.println(#); - mod_jk.println(# Auto configuration for the + path + context starts.); - mod_jk.println(#); - mod_jk.println(); + } +} + + +private void generateContextMappings(Context context, PrintWriter mod_jk ) { + String path = context.getPath(); + String vhost = context.getHost(); + + if( vhost != null ) { + // Generate Apache VirtualHost section for this host + // You'll have to do it manually right now + // XXX + return; + } + if( path.length() 1) { + // Dynamic /servet pages go to Tomcat - mod_jk.println(#);
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/07/03 16:55:27 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Added the JkDebug option - another small step in having all user setable options in server.xml ( and not having the user touch any server config file ). Note that JkDebug should be moved in workers.properties, along with many other jk options - the file is common to all servers. Right now I'll use ApacheConfig, and move later - I can't test with IIS and NES and it'll be easier to wait until everything is finished for apache, and then update the others ( by removing what will no longer be needed ) Revision ChangesPath 1.14 +16 -7 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ApacheConfig.java 2001/07/03 23:50:32 1.13 +++ ApacheConfig.java 2001/07/03 23:55:27 1.14 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.13 2001/07/03 23:50:32 costin Exp $ +/* $Id: ApacheConfig.java,v 1.14 2001/07/03 23:55:27 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -105,7 +105,7 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.13 $ $Date: 2001/07/03 23:50:32 $ + @version $Revision: 1.14 $ $Date: 2001/07/03 23:55:27 $ */ public class ApacheConfig extends BaseInterceptor { @@ -142,6 +142,8 @@ private String jkProto = null; private int portInt=0; String tomcatHome; + +private String jkDebug=null; // default is true until we can map all web.xml directives // Or detect only portable directives were used. @@ -259,6 +261,14 @@ jkProto = protocol; } + +/** Set the verbosity level for mod_jk. + ( use debug, error, etc ) + */ +public void setJkDebug( String level ) { + jkDebug=level; +} + // Initialize/guess defaults /** Initialize defaults for properties that are not set @@ -396,13 +406,12 @@ + jkLog.toString().replace('\\', '/') + \); mod_jk.println(); - mod_jk.println(#); - mod_jk.println(# Log level to be used by mod_jk); - mod_jk.println(#); // XXX Make it configurable - mod_jk.println(JkLogLevel error); - mod_jk.println(); + if( jkDebug != null ) { + mod_jk.println(JkLogLevel + jkDebug); + mod_jk.println(); + } }
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
larryi 01/06/21 06:04:19 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Add space following j_security_check to avoid syntax error. Updated to detect Ajp13Interceptor from jakarta-tomcat-connectors. Added jkProtocol property so Ajp12 or Ajp13 can be set explicitly. Revision ChangesPath 1.11 +43 -11 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ApacheConfig.java 2001/05/27 23:11:07 1.10 +++ ApacheConfig.java 2001/06/21 13:04:19 1.11 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.10 2001/05/27 23:11:07 costin Exp $ +/* $Id: ApacheConfig.java,v 1.11 2001/06/21 13:04:19 larryi Exp $ * * * The Apache Software License, Version 1.1 @@ -112,7 +112,7 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.10 $ $Date: 2001/05/27 23:11:07 $ + @version $Revision: 1.11 $ $Date: 2001/06/21 13:04:19 $ */ public class ApacheConfig extends BaseInterceptor { @@ -148,6 +148,8 @@ public static final int AJP12 = 0; public static final int AJP13 = 1; public static final String AJPV12 = ajpv12; +public static final String JTC_AJP13_INTERCEPTOR = +org.apache.ajp.tomcat33.Ajp13Interceptor; private File configHome = null; @@ -158,6 +160,7 @@ private File modJk = null; private File jkLog = null; +private int jkProtocol = -1; public ApacheConfig() { @@ -204,6 +207,7 @@ if(name.equals(modjserv)) setModJserv(value); if(name.equals(modjk)) setModJk(value); if(name.equals(jklog)) setJkLog(value); +if(name.equals(jkprotocol)) setJkProtocol(value); } /** @@ -432,7 +436,7 @@ public void setModJserv(File path){ modJserv=path; } - + /** returns the path to the apache module mod_jserv. If the path set with setModJserv() was relative, this method @@ -544,8 +548,31 @@ return logF; } +/** +set the Ajp protocal +@param bprotocal/b String protocol, ajp12 or ajp13 + */ +public void setJkProtocol(String protocol){ +jkProtocol = -1; +for( int i=0; i JkMount.length; i++ ) { +if( JkMount[i].equalsIgnoreCase(protocol) ) { +jkProtocol = i; +break; +} +} +} - +/** +get the Ajp protocol +@return a String for the Ajp protocol + */ +public String getJkProtocol(){ +if( jkProtocol 0 || jkProtocol = JkMount.length ) +return JkMount[0]; +else +return JkMount[jkProtocol]; +} + /** executes the ApacheConfig interceptor. This method generates apache configuration files for use with mod_jserv or mod_jk. If not @@ -565,7 +592,8 @@ //String apacheHome = findApache(); int jkConnector = AJP12; - + if( jkProtocol = 0 jkProtocol JkMount.length) + jkConnector = jkProtocol; PrintWriter pw=new PrintWriter(new FileWriter(getJservConfig())); log(Generating apache mod_jserv config = +getJservConfig() ); @@ -620,17 +648,21 @@ // Find Ajp1? connectors int portInt=8007; BaseInterceptor ci[]=cm.getContainer().getInterceptors(); + // try to get jakarta-tomcat-connectors Ajp13 Interceptor class + Class jtcAjp13 = null; + try { + jtcAjp13 = Class.forName(JTC_AJP13_INTERCEPTOR); + } catch ( ClassNotFoundException e ) { } for( int i=0; ici.length; i++ ) { Object con=ci[i]; -/* if( con instanceof Ajp12ConnectionHandler ) { - PoolTcpConnector tcpCon=(PoolTcpConnector) con; - portInt=tcpCon.getPort(); - }*/ if( con instanceof Ajp12Interceptor ) { Ajp12Interceptor tcpCon=(Ajp12Interceptor) con; portInt=tcpCon.getPort(); } - if( con instanceof Ajp13Interceptor ) { +// if jkProtocol not specified and Ajp13 Interceptor found, use Ajp13 +if( jkProtocol 0 +( con instanceof Ajp13Interceptor || +( jtcAjp13 != null
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/05/27 16:11:08 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Fix from Michael Jennings for form-based login in apache The new connector will probably provide a better solution in ajp14, but this is a good fix we can do now. Submitted by: [EMAIL PROTECTED] Revision ChangesPath 1.10 +10 -2 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ApacheConfig.java 2001/03/14 07:29:45 1.9 +++ ApacheConfig.java 2001/05/27 23:11:07 1.10 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.9 2001/03/14 07:29:45 larryi Exp $ +/* $Id: ApacheConfig.java,v 1.10 2001/05/27 23:11:07 costin Exp $ * * * The Apache Software License, Version 1.1 @@ -112,7 +112,7 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.9 $ $Date: 2001/03/14 07:29:45 $ + @version $Revision: 1.10 $ $Date: 2001/05/27 23:11:07 $ */ public class ApacheConfig extends BaseInterceptor { @@ -772,6 +772,14 @@ mod_jk.println(#); mod_jk.println(JkMount + path +/servlet/* + JkMount[jkConnector]); mod_jk.println(JkMount + path +/*.jsp + JkMount[jkConnector]); + mod_jk.println(# The following line mounts the + +form-based authenticator for the + +path+ context); + mod_jk.println(#); + mod_jk.println(JkMount + path + +/*j_security_check + +JkMount[jkConnector]); + // Deny serving any files from WEB-INF
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
melaquias01/03/13 14:54:34 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: fixed default static paths for generated conf files and mod_jk/jserv to be relative, not absolute. Revision ChangesPath 1.8 +6 -7 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ApacheConfig.java 2001/03/05 02:56:49 1.7 +++ ApacheConfig.java 2001/03/13 22:54:33 1.8 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.7 2001/03/05 02:56:49 melaquias Exp $ +/* $Id: ApacheConfig.java,v 1.8 2001/03/13 22:54:33 melaquias Exp $ * * * The Apache Software License, Version 1.1 @@ -112,19 +112,18 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.7 $ $Date: 2001/03/05 02:56:49 $ + @version $Revision: 1.8 $ $Date: 2001/03/13 22:54:33 $ */ public class ApacheConfig extends BaseInterceptor { -// XXX maybe conf/ /** default path to JServ .conf location */ -public static final String APACHE_CONFIG="/conf/jserv/tomcat-apache.conf"; +public static final String APACHE_CONFIG="conf/jserv/tomcat-apache.conf"; /** default path to mod_jk .conf location */ -public static final String MOD_JK_CONFIG = "/conf/jk/mod_jk.conf"; +public static final String MOD_JK_CONFIG = "conf/jk/mod_jk.conf"; /** default path to workers.properties file */ -public static final String WORKERS_CONFIG = "/conf/jk/workers.properties"; +public static final String WORKERS_CONFIG = "conf/jk/workers.properties"; /** default mod_jk log file location */ -public static final String JK_LOG_LOCATION = "/logs/mod_jk.log"; +public static final String JK_LOG_LOCATION = "logs/mod_jk.log"; /** default location of mod_jserv Apache plug-in. */ public static final String MOD_JSERV; /** default location of mod_jk Apache plug-in. */ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
larryi 01/03/13 23:29:45 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: If the absolute path to mod_jserv or mod_jk doesn't exist, use relative path. This restores previous behavior if just ApacheConfig / is added to the server.xml. Revision ChangesPath 1.9 +8 -2 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ApacheConfig.java 2001/03/13 22:54:33 1.8 +++ ApacheConfig.java 2001/03/14 07:29:45 1.9 @@ -1,4 +1,4 @@ -/* $Id: ApacheConfig.java,v 1.8 2001/03/13 22:54:33 melaquias Exp $ +/* $Id: ApacheConfig.java,v 1.9 2001/03/14 07:29:45 larryi Exp $ * * * The Apache Software License, Version 1.1 @@ -112,7 +112,7 @@ p @author Costin Manolache @author Mel Martinez - @version $Revision: 1.8 $ $Date: 2001/03/13 22:54:33 $ + @version $Revision: 1.9 $ $Date: 2001/03/14 07:29:45 $ */ public class ApacheConfig extends BaseInterceptor { @@ -439,6 +439,7 @@ will try first to resolve it absolutely against the return value of getConfigHome(). If that is null, then it instead will resolve against the current user.dir. +If this file doesn't exist, the relative path is returned. p @return a File object with the path to the mod_jserv.so file. */ @@ -453,6 +454,8 @@ }else{//resolve against user.dir jservF = new File(jservF.getAbsolutePath()); } + if( !jservF.exists() ) + jservF = modJserv; } return jservF; } @@ -479,6 +482,7 @@ will try first to resolve it absolutely against the return value of getConfigHome(). If that is null, then it instead will resolve against the current user.dir. +If this file doesn't exist, the relative path is returned. p @return a File object with the path to the mod_jk.so file. */ @@ -493,6 +497,8 @@ }else{//resolve against user.dir jkF = new File(jkF.getAbsolutePath()); } + if( !jkF.exists() ) + jkF = modJk; } return jkF; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
danmil 01/02/05 15:29:57 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Added configuraton for NetWare. Contributed by: Mike Anderson ([EMAIL PROTECTED]) Revision ChangesPath 1.4 +7 -0 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ApacheConfig.java 2001/02/02 04:26:21 1.3 +++ ApacheConfig.java 2001/02/05 23:29:56 1.4 @@ -151,6 +151,13 @@ mod_jk.println(); mod_jk.println("JkWorkersFile \"" + new File(tomcatHome, WORKERS_CONFIG).toString().replace('\\', '/') + "\""); mod_jk.println("JkLogFile \"" + new File(tomcatHome, JK_LOG_LOCATION).toString().replace('\\', '/') + "\""); + } else if( System.getProperty( "os.name" ).startsWith("NetWare")) { + // NetWare is a special case + pw.println("LoadModule jserv_module modules/JServ.nlm"); + mod_jk.println("LoadModule jk_module modules/mod_jk.nlm"); + mod_jk.println(); + mod_jk.println("JkWorkersFile \"" + new File(tomcatHome, WORKERS_CONFIG).toString().replace('\\', '/') + "\""); + mod_jk.println("JkLogFile \"" + new File(tomcatHome, JK_LOG_LOCATION).toString().replace('\\', '/') + "\""); } else { // XXX XXX change it to mod_jserv_${os.name}.so, put all so in tomcat // home - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
costin 01/02/01 20:26:22 Modified:src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Small change - generate the config when the server is fully configured ( i.e. after auto loading webapps ). Regenerate the apache config whenever a new context is added. ( it would be nice to send a restart signal to apache - but no time now ) Revision ChangesPath 1.3 +34 -5 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ApacheConfig.java 2001/01/28 21:30:35 1.2 +++ ApacheConfig.java 2001/02/02 04:26:21 1.3 @@ -93,20 +93,49 @@ return null; } -Log loghelper = new Log("tc_log", this); +/** Generate the apache configuration - only when the server is + * completely initialized ( before starting ) + */ +public void engineState( ContextManager cm, int state ) + throws TomcatException +{ + if( state != ContextManager.STATE_INIT ) + return; + + execute( cm ); +} + +public void contextInit(Context ctx) + throws TomcatException +{ + ContextManager cm=ctx.getContextManager(); + if( cm.getState() = ContextManager.STATE_INIT ) { + // a context has been added after the server was started. + // regenerate the config ( XXX send a restart signal to + // the server ) + execute( cm ); + } +} + -public void engineStart(ContextManager cm) throws TomcatException { +Log loghelper = new Log("tc_log", this); + +public void execute(ContextManager cm) throws TomcatException { try { String tomcatHome = cm.getHome(); String apacheHome = findApache(); int jkConnector = AJP12; - //log("Tomcat home= " + tomcatHome); - FileWriter configW=new FileWriter(tomcatHome + APACHE_CONFIG); PrintWriter pw=new PrintWriter(configW); -PrintWriter mod_jk = new PrintWriter(new FileWriter(tomcatHome + MOD_JK_CONFIG + "-auto")); + + + PrintWriter mod_jk = new PrintWriter(new FileWriter(tomcatHome + MOD_JK_CONFIG + "-auto")); + + log("Generating apache config = " + tomcatHome + + MOD_JK_CONFIG + "-auto" ); + mod_jk.println("###"); mod_jk.println("# Auto generated configuration. Dated: " + new Date()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java
danmil 01/01/28 13:30:35 Modified:src/etc server.xml src/share/org/apache/tomcat/modules/config ApacheConfig.java Log: Fixed autogeneration of mod_jk.conf files by Tomcat, and added intelligence about ajp13 v. ajp12. The generated file will use ajp13 if Tomcat is configured to have interceptors for both. Also, adding an Ajp13Interceptor to the default server.xml config. Contributed by Keith Wannamaker ([EMAIL PROTECTED]). Revision ChangesPath 1.63 +12 -0 jakarta-tomcat/src/etc/server.xml Index: server.xml === RCS file: /home/cvs/jakarta-tomcat/src/etc/server.xml,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- server.xml2001/01/28 19:19:11 1.62 +++ server.xml2001/01/28 21:30:35 1.63 @@ -109,6 +109,12 @@ ContextInterceptor className="org.apache.tomcat.modules.config.AutoSetup" / +!-- Generate includeable Apache configuration files for mod_jserv + and mod_jk. + -- +ContextInterceptor +className="org.apache.tomcat.modules.config.ApacheConfig" / + ContextInterceptor className="org.apache.tomcat.facade.WebXmlReader" / @@ -279,6 +285,12 @@ RequestInterceptor className="org.apache.tomcat.modules.server.Ajp12Interceptor" port="8007" / + +!-- Apache AJP13 support (mod_jk) + -- +RequestInterceptor + className="org.apache.tomcat.modules.server.Ajp13Interceptor" + port="8009" / !-- Special webapps -- !-- You don't need this if you place your app in webapps/ 1.2 +18 -8 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ApacheConfig.java 2000/12/28 19:50:42 1.1 +++ ApacheConfig.java 2001/01/28 21:30:35 1.2 @@ -65,8 +65,9 @@ import java.net.*; import java.util.*; -// Used to find Ajp12 connector port +// Used to find Ajp1? connector port import org.apache.tomcat.modules.server.Ajp12Interceptor; +import org.apache.tomcat.modules.server.Ajp13Interceptor; /** * Used by ContextManager to generate automatic apache configurations @@ -80,6 +81,11 @@ public static final String WORKERS_CONFIG = "/conf/jk/workers.properties"; public static final String JK_LOG_LOCATION = "/logs/mod_jk.log"; +public static final String[] JkMount = { "ajp12", "ajp13" }; +public static final int AJP12 = 0; +public static final int AJP13 = 1; +public static final String AJPV12 = "ajpv12"; + public ApacheConfig() { } @@ -90,10 +96,11 @@ Log loghelper = new Log("tc_log", this); -public void execute(ContextManager cm) throws TomcatException { +public void engineStart(ContextManager cm) throws TomcatException { try { String tomcatHome = cm.getHome(); String apacheHome = findApache(); + int jkConnector = AJP12; //log("Tomcat home= " + tomcatHome); @@ -127,13 +134,13 @@ pw.println("ApJServManual on"); - pw.println("ApJServDefaultProtocol ajpv12"); + pw.println("ApJServDefaultProtocol " + AJPV12); pw.println("ApJServSecretKey DISABLED"); pw.println("ApJServMountCopy on"); pw.println("ApJServLogLevel notice"); pw.println(); - // Find Ajp12 connector + // Find Ajp1? connectors int portInt=8007; BaseInterceptor ci[]=cm.getContainer().getInterceptors(); for( int i=0; ici.length; i++ ) { @@ -146,6 +153,9 @@ Ajp12Interceptor tcpCon=(Ajp12Interceptor) con; portInt=tcpCon.getPort(); } + if( con instanceof Ajp13Interceptor ) { + jkConnector = AJP13; + } } pw.println("ApJServDefaultPort " + portInt); pw.println(); @@ -195,8 +205,8 @@ mod_jk.println("#"); mod_jk.println("# Root context mounts for Tomcat"); mod_jk.println("#"); -mod_jk.println("JkMount /*.jsp ajp12"); -mod_jk.println("JkMount /servlet/* ajp12"); +mod_jk.println("JkMount /*.jsp " + JkMount[jkConnector]); +mod_jk.println("JkMount /servlet/* " + JkMount[jkConnector]); mod_jk.println(); // Set
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ApacheConfig.java IISConfig.java NSConfig.java
costin 00/12/28 11:50:42 Modified:src/share/org/apache/tomcat/task StartTomcat.java Added: src/share/org/apache/tomcat/modules/config ApacheConfig.java IISConfig.java NSConfig.java Removed: src/share/org/apache/tomcat/task ApacheConfig.java IISConfig.java NSConfig.java Log: Transformed the "automatic server config" generators in modules. Those classes were an attempt to simplify the server configuration for "integrated" mode. The problem is that tomcat can add/remove applications at runtime, modules like AutoSetup can also add applications. Another problem is that users still need to edit the files. One thing is clear - the code in doesn't work as it should. By turning the generators into modules we allow access to all server hooks - it will be possible to regenerate the configs ( and maybe restart the server) when a context is added/removed, even at runtime. We'll also have more flexibility in configuring ( we can add only the generator we need, and pass the location of apache/iis/nes, etc ). The code is low-priority - if ajp1x-based autoconfiguration will work this will no longer be needed. I think there is a lot of work to be done to fully integrate with the server ( like using the native-authentication, etc), and I don't think that can be done in 3.3 timeframe - but later, as a module. I would even propose removing them completely from the 3.3 distribution, since they are not essential ( and were never completed ) Revision ChangesPath 1.9 +0 -48 jakarta-tomcat/src/share/org/apache/tomcat/task/StartTomcat.java Index: StartTomcat.java === RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/task/StartTomcat.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- StartTomcat.java 2000/11/02 21:45:09 1.8 +++ StartTomcat.java 2000/12/28 19:50:42 1.9 @@ -94,29 +94,8 @@ } public void execute() throws Exception { - if( doHelp ) { - printUsage(); - return; - } - if( doStop ) { - org.apache.tomcat.task.StopTomcat task= - new org.apache.tomcat.task.StopTomcat(); - - task.setConfig( configFile ); - task.execute(); - return; - } - ContextManager cm=prepareContextManager(); - // XXX Make this optional, and make sure it doesn't require - // a full start. It is called after init to make sure - // auto-configured contexts are initialized. - if( doGenerateConfigs ) { - generateServerConfig( cm ); - return; - } - try { cm.start(); // start serving } @@ -188,33 +167,6 @@ public void setServerClassPath( URL urls[] ) { serverClassPath=urls; -} - -/** This method will generate Server config files that - reflect the existing cm settings. It is called - at startup, and may be called when a new context is - added ( at runtime for example ). -*/ -public static void generateServerConfig( ContextManager cm ) - throws TomcatException -{ - // Generate Apache configs - // - org.apache.tomcat.task.ApacheConfig apacheConfig= - new org.apache.tomcat.task.ApacheConfig(); - apacheConfig.execute( cm ); - - // Generate IIS configs - // - org.apache.tomcat.task.IISConfig iisConfig= - new org.apache.tomcat.task.IISConfig(); - iisConfig.execute( cm ); - - // Generate Netscape configs - // - org.apache.tomcat.task.NSConfig nsConfig= - new org.apache.tomcat.task.NSConfig(); - nsConfig.execute( cm ); } public static void printUsage() { 1.1 jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ApacheConfig.java Index: ApacheConfig.java === /* * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation