| java.lang.Object org.apache.jk.config.BaseJkConfig
All known Subclasses: org.apache.jk.config.NSConfig, org.apache.jk.config.ApacheConfig, org.apache.jk.config.IISConfig,
BaseJkConfig | public class BaseJkConfig implements LifecycleListener(Code) | | Base class for automatic jk based configurations based on
the Tomcat server.xml settings and the war contexts
initialized during startup.
This config interceptor is enabled by inserting a Config
element in the <ContextManager> tag body inside
the server.xml file like so:
< ContextManager ... >
...
<???Config options />
...
< /ContextManager >
where options can include any of the following attributes:
- configHome - default parent directory for the following paths.
If not set, this defaults to TOMCAT_HOME. Ignored
whenever any of the following paths is absolute.
- workersConfig - path to workers.properties file used by
jk connector. If not set, defaults to
"conf/jk/workers.properties".
- jkLog - path to log file to be used by jk connector.
- jkDebug - Loglevel setting. May be debug, info, error, or emerg.
If not set, defaults to emerg.
- jkWorker The desired worker. Must be set to one of the workers
defined in the workers.properties file. "ajp12", "ajp13"
or "inprocess" are the workers found in the default
workers.properties file. If not specified, defaults
to "ajp13" if an Ajp13Interceptor is in use, otherwise
it defaults to "ajp12".
- forwardAll - 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
configuration is actually being set in Apache.
- noRoot - If true, the root context is not mapped to
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 may also
need to modify the web server to point it's home
directory to Tomcat's root context directory.
Otherwise some content, such as the root index.html,
may be served by the web server before the connector
gets a chance to claim the request and pass it to Tomcat.
The default is true.
author: Costin Manolache author: Larry Isaacs author: Bill Barker version: $Revision: 1.2 $ |
Method Summary | |
protected boolean | addExtensionMapping(String ctxPath, String ext, PrintWriter pw) Add an extension mapping. | protected boolean | addMapping(String fullPath, PrintWriter pw) Add a fulling specified mapping. | public void | execute(LifecycleEvent evt) Generate configuration files. | public void | executeContext(Context context, PrintWriter mod_jk) executes the ApacheConfig interceptor. | protected void | executeEngine(Engine egn, PrintWriter mod_jk) Generate configuration files. | protected void | executeHost(Host hst, PrintWriter mod_jk) Generate configuration files. | public void | executeServer(Server svr, PrintWriter mod_jk) Generate configuration files. | protected void | generateContextMappings(Context context, PrintWriter mod_jk) | protected boolean | generateJkHead(PrintWriter mod_jk) | protected void | generateJkTail(PrintWriter mod_jk) | protected void | generateSSLConfig(PrintWriter mod_jk) | protected void | generateStupidMappings(Context context, PrintWriter mod_jk) | protected void | generateVhostHead(Host host, PrintWriter mod_jk) | protected void | generateVhostTail(Host host, PrintWriter mod_jk) | protected String | getAbsoluteDocBase(Context context) | public static File | getConfigFile(File base, File configDir, String defaultF) | protected Host | getHost(Container child) Get the host associated with this Container (if any). | protected PrintWriter | getWriter() Get the output Writer. | protected void | initProperties() | public static boolean | isAbsolute(String path) | public void | lifecycleEvent(LifecycleEvent evt) | protected void | log(String msg) | public static String | patch(String path) | public void | setAppend(boolean apnd) Append to config file. | public void | setConfigHome(String dir) set a path to the parent directory of the
conf folder. | public void | setForwardAll(boolean b) If false, we'll try to generate a config that will
let apache serve static files. | public void | setJkDebug(String level) Set the verbosity level
( use debug, error, etc. | public void | setJkLog(String path) | public void | setJkWorker(String worker) | public void | setLegacy(boolean legacy) | public void | setNoRoot(boolean b) Special option - do not generate mappings for the ROOT
context. | public void | setWorkersConfig(String path) set a path to the workers.properties file. |
append | protected boolean append(Code) | | |
debug | protected int debug(Code) | | |
forwardAll | protected boolean forwardAll(Code) | | |
legacy | protected boolean legacy(Code) | | |
noRoot | protected boolean noRoot(Code) | | |
regenerate | protected boolean regenerate(Code) | | |
addExtensionMapping | protected boolean addExtensionMapping(String ctxPath, String ext, PrintWriter pw)(Code) | | Add an extension mapping. Override with method to generate
web server specific configuration
|
addMapping | protected boolean addMapping(String fullPath, PrintWriter pw)(Code) | | Add a fulling specified mapping. Override with method to generate
web server specific configuration
|
execute | public void execute(LifecycleEvent evt)(Code) | | Generate configuration files. Override with method to generate
web server specific configuration.
|
executeContext | public void executeContext(Context context, PrintWriter mod_jk)(Code) | | executes the ApacheConfig interceptor. This method generates apache
configuration files for use with mod_jk.
context a Context object. mod_jk Writer for output. |
executeEngine | protected void executeEngine(Engine egn, PrintWriter mod_jk)(Code) | | Generate configuration files. Override with method to generate
web server specific configuration.
|
executeHost | protected void executeHost(Host hst, PrintWriter mod_jk)(Code) | | Generate configuration files. Override with method to generate
web server specific configuration.
|
executeServer | public void executeServer(Server svr, PrintWriter mod_jk)(Code) | | Generate configuration files. Override with method to generate
web server specific configuration.
|
generateContextMappings | protected void generateContextMappings(Context context, PrintWriter mod_jk)(Code) | | |
generateJkHead | protected boolean generateJkHead(PrintWriter mod_jk)(Code) | | Generate general options
|
generateJkTail | protected void generateJkTail(PrintWriter mod_jk)(Code) | | Generate general options
|
generateSSLConfig | protected void generateSSLConfig(PrintWriter mod_jk)(Code) | | Generate SSL options
|
generateStupidMappings | protected void generateStupidMappings(Context context, PrintWriter mod_jk)(Code) | | |
generateVhostHead | protected void generateVhostHead(Host host, PrintWriter mod_jk)(Code) | | Generate Virtual Host start
|
generateVhostTail | protected void generateVhostTail(Host host, PrintWriter mod_jk)(Code) | | Generate Virtual Host end
|
getAbsoluteDocBase | protected String getAbsoluteDocBase(Context context)(Code) | | |
getHost | protected Host getHost(Container child)(Code) | | Get the host associated with this Container (if any).
|
getWriter | protected PrintWriter getWriter() throws IOException(Code) | | Get the output Writer. Override with method to generate
web server specific configuration.
|
initProperties | protected void initProperties()(Code) | | Initialize defaults for properties that are not set
explicitely
|
isAbsolute | public static boolean isAbsolute(String path)(Code) | | |
lifecycleEvent | public void lifecycleEvent(LifecycleEvent evt)(Code) | | Generate the configuration - only when the server is
completely initialized ( before starting )
|
setAppend | public void setAppend(boolean apnd)(Code) | | Append to config file.
Set to true if the config information should be
appended.
|
setConfigHome | public void setConfigHome(String dir)(Code) | | set a path to the parent directory of the
conf folder. That is, the parent directory
within which path setters would be resolved against,
if relative. For example if ConfigHome is set to "/home/tomcat"
and regConfig is set to "conf/mod_jk.conf" then the resulting
path used would be:
"/home/tomcat/conf/mod_jk.conf".
However, if the path is set to an absolute path,
this attribute is ignored.
If not set, execute() will set this to TOMCAT_HOME.
dir - path to a directory |
setForwardAll | public void setForwardAll(boolean b)(Code) | | If false, we'll try to generate a config that will
let apache serve static files.
The default is true, forward all requests in a context
to tomcat.
|
setJkDebug | public void setJkDebug(String level)(Code) | | Set the verbosity level
( use debug, error, etc. ) If not set, no log is written.
|
setJkLog | public void setJkLog(String path)(Code) | | set the path to the log file
path String path to a file |
setJkWorker | public void setJkWorker(String worker)(Code) | | set the Ajp protocal
protocal String protocol, "ajp12" or "ajp13" |
setLegacy | public void setLegacy(boolean legacy)(Code) | | |
setNoRoot | public void setNoRoot(boolean b)(Code) | | 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).
This means that the web server's root remains intact but isn't
completely servlet/JSP enabled. If the ROOT webapp can be configured
with the web server serving static files, there's no problem setting
this option to false. If not, then setting it true means the web
server will be out of picture for all requests.
|
setWorkersConfig | public void setWorkersConfig(String path)(Code) | | set a path to the workers.properties file.
path String path to workers.properties file |
|
|