|
What this is
Other links
The source code/* * Copyright 1999-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.jk.server; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; import java.util.StringTokenizer; import java.util.Vector; import javax.management.MBeanRegistration; import javax.management.MBeanServer; import javax.management.ObjectName; import org.apache.commons.modeler.Registry; import org.apache.jk.core.JkHandler; import org.apache.jk.core.WorkerEnv; import org.apache.tomcat.util.IntrospectionUtils; /** Main class used to startup and configure jk. It manages the conf/jk2.properties file * and is the target of JMX proxy. * * It implements a policy of save-on-change - whenever a property is changed at * runtime the jk2.properties file will be overriden. * * You can edit the config file when tomcat is stoped ( or if you don't use JMX or * other admin tools ). * * The format of jk2.properties: *
channelClassName that will used to connect to
* httpd.
*/
public void setChannelClassName(String name) {
props.put( "handler.channel.className",name);
}
public String getChannelClassName() {
return (String)props.get( "handler.channel.className");
}
/**
* Set the workerClassName that will handle the request.
* ( sort of 'pivot' in axis :-)
*/
public void setWorkerClassName(String name) {
props.put( "handler.container.className",name);
}
public String getWorkerClassName() {
return (String)props.get( "handler.container.className");
}
/** Set the base dir of jk2. ( including WEB-INF if in a webapp ).
* We'll try to guess it from classpath if none is set ( for
* example on command line ), but if in a servlet environment
* you need to use Context.getRealPath or a system property or
* set it expliciltey.
*/
public void setJkHome( String s ) {
getWorkerEnv().setJkHome(s);
}
public String getJkHome() {
return getWorkerEnv().getJkHome();
}
String out;
String err;
File propsF;
public void setOut( String s ) {
this.out=s;
}
public String getOut() {
return this.out;
}
public void setErr( String s ) {
this.err=s;
}
public String getErr() {
return this.err;
}
// -------------------- Initialization --------------------
public void init() throws IOException
{
long t1=System.currentTimeMillis();
if(null != out) {
PrintStream outS=new PrintStream(new FileOutputStream(out));
System.setOut(outS);
}
if(null != err) {
PrintStream errS=new PrintStream(new FileOutputStream(err));
System.setErr(errS);
}
String home=getWorkerEnv().getJkHome();
if( home==null ) {
// XXX use IntrospectionUtil to find myself
this.guessHome();
}
home=getWorkerEnv().getJkHome();
if( home==null ) {
log.info( "Can't find home, jk2.properties not loaded");
}
if( home != null ) {
File hF=new File(home);
File conf=new File( home, "conf" );
if( ! conf.exists() )
conf=new File( home, "etc" );
propsF=new File( conf, "jk2.properties" );
if( propsF.exists() ) {
log.debug("Starting Jk2, base dir= " + home + " conf=" + propsF );
setPropertiesFile( propsF.getAbsolutePath());
} else {
log.debug("Starting Jk2, base dir= " + home );
if( log.isDebugEnabled() )
log.debug( "No properties file found " + propsF );
}
}
String initHTTPS = (String)props.get("class.initHTTPS");
if("true".equalsIgnoreCase(initHTTPS)) {
initHTTPSUrls();
}
long t2=System.currentTimeMillis();
initTime=t2-t1;
}
static String defaultHandlers[]= { "request",
"container",
"channelSocket"};
/*
static String defaultHandlers[]= { "apr",
"shm",
"request",
"container",
"channelSocket",
"channelJni",
"channelUnix"};
*/
public void stop()
{
for( int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.