| Method from org.apache.jk.config.ApacheConfig Detail: |
protected boolean addExtensionMapping(String ctxPath,
String ext,
PrintWriter mod_jk) {
if( log.isDebugEnabled() )
log.debug( "Adding extension map for " + ctxPath + "/*." + ext );
mod_jk.println(indent + "JkMount " + ctxPath + "/*." + ext
+ " " + jkWorker);
return true;
}
Add an Apache extension mapping. |
protected boolean addMapping(String fullPath,
PrintWriter mod_jk) {
if( log.isDebugEnabled() )
log.debug( "Adding map for " + fullPath );
mod_jk.println(indent + "JkMount " + fullPath + " " + jkWorker );
return true;
}
Add a fulling specified Appache mapping. |
protected boolean addMapping(String ctxP,
String ext,
PrintWriter mod_jk) {
if( log.isDebugEnabled() )
log.debug( "Adding map for " + ext );
if(! ext.startsWith("/") )
ext = "/" + ext;
if(ext.length() > 1)
mod_jk.println(indent + "JkMount " + ctxP + ext+ " " + jkWorker );
return true;
}
Add a partially specified Appache mapping. |
protected void generateContextMappings(Context context,
PrintWriter mod_jk) {
String ctxPath = context.getPath();
Host vhost = getHost(context);
if( noRoot && "".equals(ctxPath) ) {
log.debug("Ignoring root context in non-forward-all mode ");
return;
}
mod_jk.println();
mod_jk.println(indent + "#################### " +
((vhost!=null ) ? vhost.getName() + ":" : "" ) +
(("".equals(ctxPath)) ? "/" : ctxPath ) +
" ####################" );
mod_jk.println();
// Dynamic /servet pages go to Tomcat
generateStaticMappings( context, mod_jk );
// InvokerInterceptor - it doesn't have a container,
// but it's implemented using a special module.
// XXX we need to better collect all mappings
if(context.getLoginConfig() != null) {
String loginPage = context.getLoginConfig().getLoginPage();
if(loginPage != null) {
int lpos = loginPage.lastIndexOf("/");
String jscurl = loginPage.substring(0,lpos+1) + "j_security_check";
addMapping( ctxPath, jscurl, mod_jk);
}
}
String [] servletMaps = context.findServletMappings();
for(int ii=0; ii < servletMaps.length; ii++) {
addMapping( ctxPath, servletMaps[ii] , mod_jk );
}
}
|
protected boolean generateJkHead(PrintWriter mod_jk) {
mod_jk.println("########## Auto generated on " + new Date() +
"##########" );
mod_jk.println();
// Fail if mod_jk not found, let the user know the problem
// instead of running into problems later.
if( ! modJk.exists() ) {
log.info( "mod_jk location: " + modJk );
log.info( "Make sure it is installed corectly or " +
" set the config location" );
log.info( "Using < Listener className=\""+getClass().getName()+"\" modJk=\"PATH_TO_MOD_JK.SO_OR_DLL\" / >" );
}
// Verify the file exists !!
mod_jk.println("< IfModule !mod_jk.c >");
mod_jk.println(" LoadModule jk_module \""+
modJk.toString().replace('\\','/') +
"\"");
mod_jk.println("< /IfModule >");
mod_jk.println();
// Fail if workers file not found, let the user know the problem
// instead of running into problems later.
if( ! workersConfig.exists() ) {
log.warn( "Can't find workers.properties at " + workersConfig );
log.warn( "Please install it in the default location or " +
" set the config location" );
log.warn( "Using < Listener className=\"" + getClass().getName() + "\" workersConfig=\"FULL_PATH\" / >" );
return false;
}
mod_jk.println("JkWorkersFile \""
+ workersConfig.toString().replace('\\', '/')
+ "\"");
mod_jk.println("JkLogFile \""
+ jkLog.toString().replace('\\', '/')
+ "\"");
mod_jk.println();
if( jkDebug != null ) {
mod_jk.println("JkLogLevel " + jkDebug);
mod_jk.println();
}
return true;
}
Generate the loadModule and general options |
protected void generateSSLConfig(PrintWriter mod_jk) {
if( ! sslExtract ) {
mod_jk.println("JkExtractSSL Off");
}
if( ! "HTTPS".equalsIgnoreCase( sslHttpsIndicator ) ) {
mod_jk.println("JkHTTPSIndicator " + sslHttpsIndicator);
}
if( ! "SSL_SESSION_ID".equalsIgnoreCase( sslSessionIndicator )) {
mod_jk.println("JkSESSIONIndicator " + sslSessionIndicator);
}
if( ! "SSL_CIPHER".equalsIgnoreCase( sslCipherIndicator )) {
mod_jk.println("JkCIPHERIndicator " + sslCipherIndicator);
}
if( ! "SSL_CLIENT_CERT".equalsIgnoreCase( sslCertsIndicator )) {
mod_jk.println("JkCERTSIndicator " + sslCertsIndicator);
}
mod_jk.println();
}
|
protected void generateStupidMappings(Context context,
PrintWriter mod_jk) {
String ctxPath = context.getPath();
if(ctxPath == null)
return;
String nPath=("".equals(ctxPath)) ? "/" : ctxPath;
mod_jk.println();
mod_jk.println(indent + "JkMount " + nPath + " " + jkWorker );
if( "".equals(ctxPath) ) {
mod_jk.println(indent + "JkMount " + nPath + "* " + jkWorker );
if ( context.getParent() instanceof Host ) {
mod_jk.println(indent + "DocumentRoot \"" +
getApacheDocBase(context) + "\"");
} else {
mod_jk.println(indent +
"# To avoid Apache serving root welcome files from htdocs, update DocumentRoot");
mod_jk.println(indent +
"# to point to: \"" + getApacheDocBase(context) + "\"");
}
} else {
mod_jk.println(indent + "JkMount " + nPath + "/* " + jkWorker );
}
}
Forward all requests for a context to tomcat.
The default. |
protected void generateVhostHead(Host host,
PrintWriter mod_jk) {
mod_jk.println();
String vhostip = host.getName();
String vhost = vhostip;
int ppos = vhost.indexOf(":");
if(ppos >= 0)
vhost = vhost.substring(0,ppos);
mod_jk.println("< VirtualHost "+ vhostip + " >");
mod_jk.println(" ServerName " + vhost );
String [] aliases=host.findAliases();
if( aliases.length > 0 ) {
mod_jk.print(" ServerAlias " );
for( int ii=0; ii < aliases.length ; ii++) {
mod_jk.print( aliases[ii] + " " );
}
mod_jk.println();
}
indent=" ";
}
|
protected void generateVhostTail(Host host,
PrintWriter mod_jk) {
mod_jk.println("< /VirtualHost >");
indent="";
}
|
protected PrintWriter getWriter() throws IOException {
String abJkConfig = jkConfig.getAbsolutePath();
return new PrintWriter(new FileWriter(abJkConfig, append));
}
|
protected void initProperties() {
super.initProperties();
jkConfig= getConfigFile( jkConfig, configHome, MOD_JK_CONFIG);
workersConfig=getConfigFile( workersConfig, configHome,
WORKERS_CONFIG);
if( modJk == null )
modJk=new File(MOD_JK);
else
modJk=getConfigFile( modJk, configHome, MOD_JK );
jkLog=getConfigFile( jkLog, configHome, JK_LOG_LOCATION);
}
Initialize defaults for properties that are not set
explicitely |
public void setCertsIndicator(String s) {
sslCertsIndicator=s;
}
What is the indicator for the client SSL certificated(default
is SSL_CLIENT_CERT |
public void setCipherIndicator(String s) {
sslCipherIndicator=s;
}
What is the indicator for client SSL cipher suit (default is SSL_CIPHER) |
public void setExtractSSL(boolean sslMode) {
this.sslExtract=sslMode;
}
By default mod_jk is configured to collect SSL information from
the apache environment and send it to the Tomcat workers. The
problem is that there are many SSL solutions for Apache and as
a result the environment variable names may change.
The following JK related SSL configureation
can be used to customize mod_jk's SSL behaviour.
Should mod_jk send SSL information to Tomact (default is On) |
public void setHttpsIndicator(String s) {
sslHttpsIndicator=s;
}
What is the indicator for SSL (default is HTTPS) |
public void setJkConfig(String path) {
jkConfig= (path==null)?null:new File(path);
}
set the path to the output file for the auto-generated
mod_jk configuration file. If this path is relative
then it will be resolved absolutely against
the getConfigHome() path.
|
public void setModJk(String path) {
modJk=( path==null?null:new File(path));
}
set the path to the mod_jk Apache Module |
public void setSessionIndicator(String s) {
sslSessionIndicator=s;
}
What is the indicator for SSL session (default is SSL_SESSION_ID) |