Patch from Tobi Schäfer to pass Jetty XML configuration file to Helma server.
This commit is contained in:
parent
2fc811ccc0
commit
9f2238c019
2 changed files with 45 additions and 27 deletions
|
@ -77,6 +77,9 @@ public class Server implements Runnable {
|
||||||
InetAddrPort websrvPort = null;
|
InetAddrPort websrvPort = null;
|
||||||
InetAddrPort ajp13Port = null;
|
InetAddrPort ajp13Port = null;
|
||||||
|
|
||||||
|
// Jetty configuration file
|
||||||
|
File configFile = null;
|
||||||
|
|
||||||
// map of server-wide database sources
|
// map of server-wide database sources
|
||||||
Hashtable dbSources;
|
Hashtable dbSources;
|
||||||
|
|
||||||
|
@ -105,6 +108,7 @@ public class Server implements Runnable {
|
||||||
websrvPort = config.getWebsrvPort();
|
websrvPort = config.getWebsrvPort();
|
||||||
ajp13Port = config.getAjp13Port();
|
ajp13Port = config.getAjp13Port();
|
||||||
hopHome = config.getHomeDir();
|
hopHome = config.getHomeDir();
|
||||||
|
configFile = config.getConfigFile();
|
||||||
|
|
||||||
// create system properties
|
// create system properties
|
||||||
sysProps = new ResourceProperties();
|
sysProps = new ResourceProperties();
|
||||||
|
@ -260,6 +264,8 @@ public class Server implements Runnable {
|
||||||
} catch (Exception portx) {
|
} catch (Exception portx) {
|
||||||
throw new Exception("Error parsing AJP1.3 server port property: " + portx);
|
throw new Exception("Error parsing AJP1.3 server port property: " + portx);
|
||||||
}
|
}
|
||||||
|
} else if (args[i].equals("-c") && ((i + 1) < args.length)) {
|
||||||
|
config.setConfigFile(new File(args[++i]));
|
||||||
} else if (args[i].equals("-i") && ((i + 1) < args.length)) {
|
} else if (args[i].equals("-i") && ((i + 1) < args.length)) {
|
||||||
// eat away the -i parameter which is meant for helma.main.launcher.Main
|
// eat away the -i parameter which is meant for helma.main.launcher.Main
|
||||||
i++;
|
i++;
|
||||||
|
@ -326,6 +332,7 @@ public class Server implements Runnable {
|
||||||
System.out.println("Possible options:");
|
System.out.println("Possible options:");
|
||||||
System.out.println(" -h dir Specify hop home directory");
|
System.out.println(" -h dir Specify hop home directory");
|
||||||
System.out.println(" -f file Specify server.properties file");
|
System.out.println(" -f file Specify server.properties file");
|
||||||
|
System.out.println(" -c jetty.xml Specify Jetty XML configuration file");
|
||||||
System.out.println(" -w [ip:]port Specify embedded web server address/port");
|
System.out.println(" -w [ip:]port Specify embedded web server address/port");
|
||||||
System.out.println(" -x [ip:]port Specify XML-RPC address/port");
|
System.out.println(" -x [ip:]port Specify XML-RPC address/port");
|
||||||
System.out.println(" -jk [ip:]port Specify AJP13 address/port");
|
System.out.println(" -jk [ip:]port Specify AJP13 address/port");
|
||||||
|
@ -560,39 +567,41 @@ public class Server implements Runnable {
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if ((websrvPort != null) || (ajp13Port != null)) {
|
if (configFile != null && configFile.exists()) {
|
||||||
|
http = new org.mortbay.jetty.Server(configFile.toURI().toURL());
|
||||||
|
} else if ((websrvPort != null) || (ajp13Port != null)) {
|
||||||
http = new HttpServer();
|
http = new HttpServer();
|
||||||
}
|
|
||||||
|
|
||||||
// start embedded web server if port is specified
|
// start embedded web server if port is specified
|
||||||
if (websrvPort != null) {
|
if (websrvPort != null) {
|
||||||
http.addListener(websrvPort);
|
http.addListener(websrvPort);
|
||||||
}
|
|
||||||
|
|
||||||
// activate the ajp13-listener
|
|
||||||
if (ajp13Port != null) {
|
|
||||||
// create AJP13Listener
|
|
||||||
ajp13 = new AJP13Listener(ajp13Port);
|
|
||||||
ajp13.setHttpServer(http);
|
|
||||||
|
|
||||||
String jkallow = sysProps.getProperty("allowAJP13");
|
|
||||||
|
|
||||||
// by default the AJP13-connection just accepts requests from 127.0.0.1
|
|
||||||
if (jkallow == null) {
|
|
||||||
jkallow = "127.0.0.1";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(jkallow, " ,;");
|
// activate the ajp13-listener
|
||||||
String[] jkallowarr = new String[st.countTokens()];
|
if (ajp13Port != null) {
|
||||||
int cnt = 0;
|
// create AJP13Listener
|
||||||
|
ajp13 = new AJP13Listener(ajp13Port);
|
||||||
|
ajp13.setHttpServer(http);
|
||||||
|
|
||||||
while (st.hasMoreTokens()) {
|
String jkallow = sysProps.getProperty("allowAJP13");
|
||||||
jkallowarr[cnt] = st.nextToken();
|
|
||||||
cnt++;
|
// by default the AJP13-connection just accepts requests from 127.0.0.1
|
||||||
|
if (jkallow == null) {
|
||||||
|
jkallow = "127.0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringTokenizer st = new StringTokenizer(jkallow, " ,;");
|
||||||
|
String[] jkallowarr = new String[st.countTokens()];
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
while (st.hasMoreTokens()) {
|
||||||
|
jkallowarr[cnt] = st.nextToken();
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ajp13.setRemoteServers(jkallowarr);
|
||||||
|
logger.info("Starting AJP13-Listener on port " + (ajp13Port));
|
||||||
}
|
}
|
||||||
|
|
||||||
ajp13.setRemoteServers(jkallowarr);
|
|
||||||
logger.info("Starting AJP13-Listener on port " + (ajp13Port));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xmlrpcPort != null) {
|
if (xmlrpcPort != null) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class ServerConfig {
|
||||||
private InetAddrPort ajp13Port = null;
|
private InetAddrPort ajp13Port = null;
|
||||||
private File propFile = null;
|
private File propFile = null;
|
||||||
private File homeDir = null;
|
private File homeDir = null;
|
||||||
|
private File configFile = null;
|
||||||
|
|
||||||
public boolean hasPropFile() {
|
public boolean hasPropFile() {
|
||||||
return (propFile != null);
|
return (propFile != null);
|
||||||
|
@ -103,4 +104,12 @@ public class ServerConfig {
|
||||||
public void setHomeDir(File homeDir) {
|
public void setHomeDir(File homeDir) {
|
||||||
this.homeDir = homeDir == null ? null : homeDir.getAbsoluteFile();
|
this.homeDir = homeDir == null ? null : homeDir.getAbsoluteFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public File getConfigFile() {
|
||||||
|
return configFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigFile(File configFile) {
|
||||||
|
this.configFile = configFile == null ? null : configFile.getAbsoluteFile();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue