Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.ajp.tomcat4.config
Class ApacheConfig  view ApacheConfig download ApacheConfig.java

java.lang.Object
  extended byorg.apache.ajp.tomcat4.config.BaseJkConfig
      extended byorg.apache.ajp.tomcat4.config.ApacheConfig
All Implemented Interfaces:
org.apache.catalina.LifecycleListener

public class ApacheConfig
extends BaseJkConfig

Generates automatic apache mod_jk configurations based on the Tomcat server.xml settings and the war contexts initialized during startup.

This config interceptor is enabled by inserting an ApacheConfig Listener in the server.xml file like so:

 < Server ... >
   ...
   org.apache.ajp.tomcat4.config.ApacheConfig 
       options />
   ...
 < /Server >
    
where options can include any of the following attributes:


Field Summary
(package private)  java.lang.String indent
           
static java.lang.String JK_LOG_LOCATION
          default mod_jk log file location
private  java.io.File jkConfig
           
static java.lang.String MOD_JK
          default location of mod_jk Apache plug-in.
static java.lang.String MOD_JK_CONFIG
          default path to mod_jk .conf location
private  java.io.File modJk
           
(package private)  java.util.Hashtable NamedVirtualHosts
           
private  java.lang.String sslCertsIndicator
           
private  java.lang.String sslCipherIndicator
           
private  boolean sslExtract
           
private  java.lang.String sslHttpsIndicator
           
private  java.lang.String sslSessionIndicator
           
static java.lang.String WORKERS_CONFIG
          default path to workers.properties file This should be also auto-generated from server.xml.
 
Fields inherited from class org.apache.ajp.tomcat4.config.BaseJkConfig
append, configHome, debug, forwardAll, jkDebug, jkLog, jkWorker, noRoot, regenerate, tomcatHome, workersConfig
 
Constructor Summary
ApacheConfig()
           
 
Method Summary
protected  boolean addExtensionMapping(java.lang.String ctxPath, java.lang.String ext, java.io.PrintWriter mod_jk)
          Add an Apache extension mapping.
protected  boolean addMapping(java.lang.String fullPath, java.io.PrintWriter mod_jk)
          Add a fulling specified Appache mapping.
protected  boolean addMapping(java.lang.String ctxP, java.lang.String ext, java.io.PrintWriter mod_jk)
          Add a partially specified Appache mapping.
protected  void generateContextMappings(org.apache.catalina.Context context, java.io.PrintWriter mod_jk)
           
protected  boolean generateJkHead(java.io.PrintWriter mod_jk)
          Generate the loadModule and general options
private  void generateNameVirtualHost(java.io.PrintWriter mod_jk, java.lang.String ip)
           
protected  void generateSSLConfig(java.io.PrintWriter mod_jk)
          Generate SSL options
private  void generateStaticMappings(org.apache.catalina.Context context, java.io.PrintWriter mod_jk)
          Mappings for static content.
protected  void generateStupidMappings(org.apache.catalina.Context context, java.io.PrintWriter mod_jk)
          Forward all requests for a context to tomcat.
protected  void generateVhostHead(org.apache.catalina.Host host, java.io.PrintWriter mod_jk)
          Generate Virtual Host start
protected  void generateVhostTail(org.apache.catalina.Host host, java.io.PrintWriter mod_jk)
          Generate Virtual Host end
private  void generateWelcomeFiles(org.apache.catalina.Context context, java.io.PrintWriter mod_jk)
           
private  java.lang.String getApacheDocBase(org.apache.catalina.Context context)
           
private  java.lang.String getVirtualHostAddress(java.lang.String vhost, java.lang.String vhostip)
           
protected  java.io.PrintWriter getWriter()
          Get the output Writer.
protected  void initProperties()
          Initialize defaults for properties that are not set explicitely
 void setCertsIndicator(java.lang.String s)
          What is the indicator for the client SSL certificated(default is SSL_CLIENT_CERT
 void setCipherIndicator(java.lang.String s)
          What is the indicator for client SSL cipher suit (default is SSL_CIPHER)
 void setExtractSSL(boolean sslMode)
          By default mod_jk is configured to collect SSL information from the apache environment and send it to the Tomcat workers.
 void setHttpsIndicator(java.lang.String s)
          What is the indicator for SSL (default is HTTPS)
 void setJkConfig(java.lang.String path)
          set the path to the output file for the auto-generated mod_jk configuration file.
 void setModJk(java.lang.String path)
          set the path to the mod_jk Apache Module
 void setSessionIndicator(java.lang.String s)
          What is the indicator for SSL session (default is SSL_SESSION_ID)
 
Methods inherited from class org.apache.ajp.tomcat4.config.BaseJkConfig
execute, executeContext, executeEngine, executeHost, executeServer, generateJkTail, getAbsoluteDocBase, getConfigFile, getHost, isAbsolute, lifecycleEvent, log, patch, setAppend, setConfigHome, setForwardAll, setJkDebug, setJkLog, setJkWorker, setNoRoot, setWorkersConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOD_JK_CONFIG

public static final java.lang.String MOD_JK_CONFIG
default path to mod_jk .conf location

See Also:
Constant Field Values

WORKERS_CONFIG

public static final java.lang.String WORKERS_CONFIG
default path to workers.properties file This should be also auto-generated from server.xml.

See Also:
Constant Field Values

JK_LOG_LOCATION

public static final java.lang.String JK_LOG_LOCATION
default mod_jk log file location

See Also:
Constant Field Values

MOD_JK

public static final java.lang.String MOD_JK
default location of mod_jk Apache plug-in.


jkConfig

private java.io.File jkConfig

modJk

private java.io.File modJk

sslExtract

private boolean sslExtract

sslHttpsIndicator

private java.lang.String sslHttpsIndicator

sslSessionIndicator

private java.lang.String sslSessionIndicator

sslCipherIndicator

private java.lang.String sslCipherIndicator

sslCertsIndicator

private java.lang.String sslCertsIndicator

NamedVirtualHosts

java.util.Hashtable NamedVirtualHosts

indent

java.lang.String indent
Constructor Detail

ApacheConfig

public ApacheConfig()
Method Detail

setJkConfig

public void setJkConfig(java.lang.String 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.


setModJk

public void setModJk(java.lang.String path)
set the path to the mod_jk Apache Module


setExtractSSL

public void setExtractSSL(boolean 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)


setHttpsIndicator

public void setHttpsIndicator(java.lang.String s)
What is the indicator for SSL (default is HTTPS)


setSessionIndicator

public void setSessionIndicator(java.lang.String s)
What is the indicator for SSL session (default is SSL_SESSION_ID)


setCipherIndicator

public void setCipherIndicator(java.lang.String s)
What is the indicator for client SSL cipher suit (default is SSL_CIPHER)


setCertsIndicator

public void setCertsIndicator(java.lang.String s)
What is the indicator for the client SSL certificated(default is SSL_CLIENT_CERT


initProperties

protected void initProperties()
Initialize defaults for properties that are not set explicitely

Overrides:
initProperties in class BaseJkConfig

getWriter

protected java.io.PrintWriter getWriter()
                                 throws java.io.IOException
Description copied from class: BaseJkConfig
Get the output Writer. Override with method to generate web server specific configuration.

Overrides:
getWriter in class BaseJkConfig

generateJkHead

protected boolean generateJkHead(java.io.PrintWriter mod_jk)
Generate the loadModule and general options

Overrides:
generateJkHead in class BaseJkConfig

generateVhostHead

protected void generateVhostHead(org.apache.catalina.Host host,
                                 java.io.PrintWriter mod_jk)
Description copied from class: BaseJkConfig
Generate Virtual Host start

Overrides:
generateVhostHead in class BaseJkConfig

generateVhostTail

protected void generateVhostTail(org.apache.catalina.Host host,
                                 java.io.PrintWriter mod_jk)
Description copied from class: BaseJkConfig
Generate Virtual Host end

Overrides:
generateVhostTail in class BaseJkConfig

generateSSLConfig

protected void generateSSLConfig(java.io.PrintWriter mod_jk)
Description copied from class: BaseJkConfig
Generate SSL options

Overrides:
generateSSLConfig in class BaseJkConfig

generateStupidMappings

protected void generateStupidMappings(org.apache.catalina.Context context,
                                      java.io.PrintWriter mod_jk)
Forward all requests for a context to tomcat. The default.

Overrides:
generateStupidMappings in class BaseJkConfig

generateNameVirtualHost

private void generateNameVirtualHost(java.io.PrintWriter mod_jk,
                                     java.lang.String ip)

generateContextMappings

protected void generateContextMappings(org.apache.catalina.Context context,
                                       java.io.PrintWriter mod_jk)
Overrides:
generateContextMappings in class BaseJkConfig

addExtensionMapping

protected boolean addExtensionMapping(java.lang.String ctxPath,
                                      java.lang.String ext,
                                      java.io.PrintWriter mod_jk)
Add an Apache extension mapping.

Overrides:
addExtensionMapping in class BaseJkConfig

addMapping

protected boolean addMapping(java.lang.String fullPath,
                             java.io.PrintWriter mod_jk)
Add a fulling specified Appache mapping.

Overrides:
addMapping in class BaseJkConfig

addMapping

protected boolean addMapping(java.lang.String ctxP,
                             java.lang.String ext,
                             java.io.PrintWriter mod_jk)
Add a partially specified Appache mapping.


generateWelcomeFiles

private void generateWelcomeFiles(org.apache.catalina.Context context,
                                  java.io.PrintWriter mod_jk)

generateStaticMappings

private void generateStaticMappings(org.apache.catalina.Context context,
                                    java.io.PrintWriter mod_jk)
Mappings for static content. XXX need to add welcome files, mime mappings ( all will be handled by Mime and Static modules of apache ).


getApacheDocBase

private java.lang.String getApacheDocBase(org.apache.catalina.Context context)

getVirtualHostAddress

private java.lang.String getVirtualHostAddress(java.lang.String vhost,
                                               java.lang.String vhostip)