Finish goodbye-ajp
This commit is contained in:
commit
ffbf863046
24 changed files with 58 additions and 104 deletions
|
@ -15,9 +15,8 @@ dependencies {
|
|||
compile group: 'commons-logging', name: 'commons-logging', version: '1.2'
|
||||
compile group: 'commons-net', name: 'commons-net', version: '3.5'
|
||||
compile group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
|
||||
compile group: 'org.eclipse.jetty', name: 'jetty-ajp', version: '8.1.22.v20160922'
|
||||
compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '8.1.22.v20160922'
|
||||
compile group: 'org.eclipse.jetty', name: 'jetty-xml', version: '8.1.22.v20160922'
|
||||
compile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '9.4.3.v20170317'
|
||||
compile group: 'org.eclipse.jetty', name: 'jetty-xml', version: '9.4.3.v20170317'
|
||||
compile group: 'javax.mail', name: 'mail', version: '1.4.7'
|
||||
compile group: 'org.mozilla', name: 'rhino', version: '1.7.7.1'
|
||||
compile group: 'org.ccil.cowan.tagsoup', name: 'tagsoup', version: '1.2.1'
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/jetty-http-9.4.3.v20170317.jar
Normal file
BIN
lib/jetty-http-9.4.3.v20170317.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/jetty-io-9.4.3.v20170317.jar
Normal file
BIN
lib/jetty-io-9.4.3.v20170317.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/jetty-security-9.4.3.v20170317.jar
Normal file
BIN
lib/jetty-security-9.4.3.v20170317.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/jetty-server-9.4.3.v20170317.jar
Normal file
BIN
lib/jetty-server-9.4.3.v20170317.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/jetty-servlet-9.4.3.v20170317.jar
Normal file
BIN
lib/jetty-servlet-9.4.3.v20170317.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/jetty-util-9.4.3.v20170317.jar
Normal file
BIN
lib/jetty-util-9.4.3.v20170317.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
lib/jetty-xml-9.4.3.v20170317.jar
Normal file
BIN
lib/jetty-xml-9.4.3.v20170317.jar
Normal file
Binary file not shown.
|
@ -22,11 +22,10 @@ import helma.framework.repository.FileRepository;
|
|||
import helma.util.StringUtils;
|
||||
import org.apache.xmlrpc.XmlRpcHandler;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHandler;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
|
||||
import java.io.*;
|
||||
|
@ -478,7 +477,7 @@ public class ApplicationManager implements XmlRpcHandler {
|
|||
|
||||
// bind to Jetty HTTP server
|
||||
if (jetty != null) {
|
||||
if(context == null) {
|
||||
if (context == null) {
|
||||
context = new ContextHandlerCollection();
|
||||
jetty.getHttpServer().setHandler(context);
|
||||
}
|
||||
|
@ -501,14 +500,12 @@ public class ApplicationManager implements XmlRpcHandler {
|
|||
staticContext.start();
|
||||
}
|
||||
|
||||
appContext = new ServletContextHandler(context, pathPattern);
|
||||
appContext = new ServletContextHandler(context, pathPattern, true, true);
|
||||
Class servletClass = servletClassName == null ?
|
||||
EmbeddedServletClient.class : Class.forName(servletClassName);
|
||||
|
||||
ServletHolder holder = new ServletHolder(servletClass);
|
||||
appContext.addServlet(holder, "/*");
|
||||
|
||||
holder.setInitParameter("application", appName);
|
||||
appContext.addServlet(holder, "/*");
|
||||
|
||||
if (cookieDomain != null) {
|
||||
holder.setInitParameter("cookieDomain", cookieDomain);
|
||||
|
@ -533,7 +530,7 @@ public class ApplicationManager implements XmlRpcHandler {
|
|||
if (debug != null) {
|
||||
holder.setInitParameter("debug", debug);
|
||||
}
|
||||
|
||||
|
||||
if (protectedStaticDir != null) {
|
||||
File protectedContent = getAbsoluteFile(protectedStaticDir);
|
||||
appContext.setResourceBase(protectedContent.getPath());
|
||||
|
|
|
@ -18,9 +18,9 @@ package helma.main;
|
|||
|
||||
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.ajp.Ajp13SocketConnector;
|
||||
import org.eclipse.jetty.server.bio.SocketConnector;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.ServerConnector;
|
||||
import org.eclipse.jetty.xml.XmlConfiguration;
|
||||
|
||||
import java.net.URL;
|
||||
|
@ -33,15 +33,12 @@ public class JettyServer {
|
|||
// the embedded web server
|
||||
protected org.eclipse.jetty.server.Server http;
|
||||
|
||||
// the AJP13 Listener, used for connecting from external webserver to servlet via JK
|
||||
protected Ajp13SocketConnector ajp13;
|
||||
|
||||
public static JettyServer init(Server server, ServerConfig config) throws IOException {
|
||||
File configFile = config.getConfigFile();
|
||||
if (configFile != null && configFile.exists()) {
|
||||
return new JettyServer(configFile.toURI().toURL());
|
||||
} else if (config.hasWebsrvPort() || config.hasAjp13Port()) {
|
||||
return new JettyServer(config.getWebsrvPort(), config.getAjp13Port(), server);
|
||||
} else if (config.hasWebsrvPort()) {
|
||||
return new JettyServer(config.getWebsrvPort(), server);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -53,7 +50,6 @@ public class JettyServer {
|
|||
XmlConfiguration config = new XmlConfiguration(url);
|
||||
config.configure(http);
|
||||
|
||||
openListeners();
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
@ -61,42 +57,29 @@ public class JettyServer {
|
|||
}
|
||||
}
|
||||
|
||||
private JettyServer(InetSocketAddress webPort, InetSocketAddress ajpPort, Server server)
|
||||
private JettyServer(InetSocketAddress webPort, Server server)
|
||||
throws IOException {
|
||||
|
||||
http = new org.eclipse.jetty.server.Server();
|
||||
http.setServer(http);
|
||||
|
||||
|
||||
// start embedded web server if port is specified
|
||||
if (webPort != null) {
|
||||
Connector conn = new SelectChannelConnector();
|
||||
conn.setHost(webPort.getAddress().getHostAddress());
|
||||
conn.setPort(webPort.getPort());
|
||||
|
||||
http.addConnector(conn);
|
||||
HttpConfiguration httpConfig = new HttpConfiguration();
|
||||
httpConfig.setSendServerVersion(false);
|
||||
httpConfig.setSendDateHeader(false);
|
||||
HttpConnectionFactory connectionFactory = new HttpConnectionFactory(httpConfig);
|
||||
|
||||
ServerConnector connector = new ServerConnector(http, -1, -1, connectionFactory);
|
||||
connector.setHost(webPort.getAddress().getHostAddress());
|
||||
connector.setPort(webPort.getPort());
|
||||
connector.setIdleTimeout(30000);
|
||||
connector.setSoLingerTime(-1);
|
||||
connector.setAcceptorPriorityDelta(0);
|
||||
connector.setAcceptQueueSize(0);
|
||||
|
||||
http.addConnector(connector);
|
||||
}
|
||||
|
||||
// activate the ajp13-listener
|
||||
if (ajpPort != null) {
|
||||
// create AJP13Listener
|
||||
ajp13 = new Ajp13SocketConnector();
|
||||
ajp13.setHost(ajpPort.getAddress().getHostAddress());
|
||||
ajp13.setPort(ajpPort.getPort());
|
||||
|
||||
http.addConnector(ajp13);
|
||||
|
||||
// jetty6 does not support protection of AJP13 connections anymore
|
||||
if (server.sysProps.containsKey("allowAJP13")) {
|
||||
String message = "allowAJP13 property is no longer supported. " +
|
||||
"Please remove it from your config and use a firewall " +
|
||||
"to protect the AJP13 port";
|
||||
server.getLogger().error(message);
|
||||
throw new RuntimeException(message);
|
||||
}
|
||||
|
||||
server.getLogger().info("Starting AJP13-Listener on port " + (ajpPort));
|
||||
}
|
||||
openListeners();
|
||||
}
|
||||
|
||||
public org.eclipse.jetty.server.Server getHttpServer() {
|
||||
|
@ -104,17 +87,12 @@ public class JettyServer {
|
|||
}
|
||||
|
||||
public void start() throws Exception {
|
||||
openListeners();
|
||||
http.start();
|
||||
if (ajp13 != null) {
|
||||
ajp13.start();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() throws Exception {
|
||||
http.stop();
|
||||
if (ajp13 != null) {
|
||||
ajp13.stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
@ -127,7 +105,7 @@ public class JettyServer {
|
|||
// while start() will be called with the user we will actually run as
|
||||
Connector[] connectors = http.getConnectors();
|
||||
for (int i = 0; i < connectors.length; i++) {
|
||||
connectors[i].open();
|
||||
((ServerConnector) connectors[i]).open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.xmlrpc.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.rmi.registry.*;
|
||||
import java.rmi.server.*;
|
||||
import java.util.*;
|
||||
import java.net.*;
|
||||
|
||||
|
@ -197,14 +195,6 @@ public class Server implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
if (!config.hasAjp13Port() && sysProps.getProperty("ajp13Port") != null) {
|
||||
try {
|
||||
config.setAjp13Port(getInetSocketAddress(sysProps.getProperty("ajp13Port")));
|
||||
} catch (Exception portx) {
|
||||
throw new Exception("Error parsing AJP1.3 server port property from server.properties: " + portx);
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.hasXmlrpcPort() && sysProps.getProperty("xmlrpcPort") != null) {
|
||||
try {
|
||||
config.setXmlrpcPort(getInetSocketAddress(sysProps.getProperty("xmlrpcPort")));
|
||||
|
@ -242,12 +232,6 @@ public class Server implements Runnable {
|
|||
} catch (Exception portx) {
|
||||
throw new Exception("Error parsing web server port property: " + portx);
|
||||
}
|
||||
} else if (args[i].equals("-jk") && ((i + 1) < args.length)) {
|
||||
try {
|
||||
config.setAjp13Port(getInetSocketAddress(args[++i]));
|
||||
} catch (Exception 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)) {
|
||||
|
@ -320,7 +304,6 @@ public class Server implements Runnable {
|
|||
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(" -x [ip:]port Specify XML-RPC address/port");
|
||||
System.out.println(" -jk [ip:]port Specify AJP13 address/port");
|
||||
System.out.println("");
|
||||
System.out.println("Supported formats for server ports:");
|
||||
System.out.println(" <port-number>");
|
||||
|
@ -348,9 +331,6 @@ public class Server implements Runnable {
|
|||
checkPort(config.getXmlrpcPort());
|
||||
}
|
||||
|
||||
if (config.hasAjp13Port()) {
|
||||
checkPort(config.getAjp13Port());
|
||||
}
|
||||
} catch (Exception running) {
|
||||
System.out.println(running.getMessage());
|
||||
System.exit(1);
|
||||
|
|
|
@ -27,7 +27,6 @@ public class ServerConfig {
|
|||
|
||||
private InetSocketAddress xmlrpcPort = null;
|
||||
private InetSocketAddress websrvPort = null;
|
||||
private InetSocketAddress ajp13Port = null;
|
||||
private File propFile = null;
|
||||
private File homeDir = null;
|
||||
private File configFile = null;
|
||||
|
@ -53,10 +52,6 @@ public class ServerConfig {
|
|||
return (websrvPort != null);
|
||||
}
|
||||
|
||||
public boolean hasAjp13Port() {
|
||||
return (ajp13Port != null);
|
||||
}
|
||||
|
||||
public boolean hasApps() {
|
||||
return (apps != null);
|
||||
}
|
||||
|
@ -77,14 +72,6 @@ public class ServerConfig {
|
|||
this.websrvPort = websrvPort;
|
||||
}
|
||||
|
||||
public InetSocketAddress getAjp13Port() {
|
||||
return ajp13Port;
|
||||
}
|
||||
|
||||
public void setAjp13Port(InetSocketAddress ajp13Port) {
|
||||
this.ajp13Port = ajp13Port;
|
||||
}
|
||||
|
||||
public File getPropFile() {
|
||||
return propFile;
|
||||
}
|
||||
|
|
|
@ -35,19 +35,26 @@ import java.util.ArrayList;
|
|||
*/
|
||||
public class Main {
|
||||
public static final String[] jars = {
|
||||
"helma.jar", "rhino-1.7.7.1.jar",
|
||||
"commons-logging-1.2.jar",
|
||||
"xmlrpc-2.0.1.jar", "mail-1.4.7.jar", "activation-1.1.jar",
|
||||
"commons-fileupload-1.3.2.jar", "commons-codec-1-10.jar",
|
||||
"commons-io-2.2.jar", "commons-net-3.5.jar",
|
||||
"tagsoup-1.2.1.jar", "servlet-api-3.1.0.jar",
|
||||
"jetty-ajp-8.1.22.v20160922.jar", "jetty-continuation-8.1.22.v20160922.jar",
|
||||
"jetty-http-8.1.22.v20160922.jar", "jetty-io-8.1.22.v20160922.jar",
|
||||
"jetty-security-8.1.22.v20160922.jar", "jetty-server-8.1.22.v20160922.jar",
|
||||
"jetty-servlet-8.1.22.v20160922.jar", "jetty-util-8.1.22.v20160922.jar",
|
||||
"jetty-xml-8.1.22.v20160922.jar",
|
||||
"javax.servlet-3.0.0.v201112011016.jar"
|
||||
};
|
||||
"helma.jar",
|
||||
"rhino-1.7.7.1.jar",
|
||||
"commons-logging-1.2.jar",
|
||||
"xmlrpc-2.0.1.jar",
|
||||
"mail-1.4.7.jar",
|
||||
"activation-1.1.jar",
|
||||
"commons-fileupload-1.3.2.jar",
|
||||
"commons-codec-1-10.jar",
|
||||
"commons-io-2.2.jar",
|
||||
"commons-net-3.5.jar",
|
||||
"tagsoup-1.2.1.jar",
|
||||
"javax.servlet-api-3.1.0.jar",
|
||||
"jetty-http-9.4.3.v20170317.jar",
|
||||
"jetty-io-9.4.3.v20170317.jar",
|
||||
"jetty-security-9.4.3.v20170317.jar",
|
||||
"jetty-server-9.4.3.v20170317.jar",
|
||||
"jetty-servlet-9.4.3.v20170317.jar",
|
||||
"jetty-util-9.4.3.v20170317.jar",
|
||||
"jetty-xml-9.4.3.v20170317.jar"
|
||||
};
|
||||
|
||||
private Class serverClass;
|
||||
private Object server;
|
||||
|
|
|
@ -66,9 +66,15 @@ public class Logging extends LogFactory {
|
|||
// normalize log name
|
||||
logname = logname.replaceAll("[^\\w\\d\\.]", "");
|
||||
if ("console".equals(logdir)) {
|
||||
return getConsoleLog();
|
||||
if (logname.startsWith("org.eclipse.jetty."))
|
||||
return getConsoleLog().getSedatedLog();
|
||||
else
|
||||
return getConsoleLog();
|
||||
} else {
|
||||
return getFileLog(logname);
|
||||
if (logname.startsWith("org.eclipse.jetty."))
|
||||
return getFileLog(logname).getSedatedLog();
|
||||
else
|
||||
return getFileLog(logname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue