updated to jetty 9.4.3.v20170317

This commit is contained in:
Robert Gaggl 2017-03-27 14:17:46 +02:00
parent b0ff574e95
commit 390231e8dd
15 changed files with 54 additions and 114 deletions

BIN
lib/jetty-http.jar Normal file

Binary file not shown.

BIN
lib/jetty-io.jar Normal file

Binary file not shown.

BIN
lib/jetty-security.jar Normal file

Binary file not shown.

BIN
lib/jetty-server.jar Normal file

Binary file not shown.

BIN
lib/jetty-servlet.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/jetty-xml.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -22,11 +22,11 @@ import helma.framework.repository.FileRepository;
import helma.util.StringUtils; import helma.util.StringUtils;
import org.apache.xmlrpc.XmlRpcHandler; import org.apache.xmlrpc.XmlRpcHandler;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.mortbay.jetty.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler;
import org.mortbay.jetty.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.mortbay.jetty.handler.ResourceHandler; import org.eclipse.jetty.server.handler.ResourceHandler;
import org.mortbay.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletContextHandler;
import org.mortbay.jetty.servlet.ServletHolder; import org.eclipse.jetty.servlet.ServletHolder;
import java.io.*; import java.io.*;
import java.util.*; import java.util.*;
@ -304,7 +304,7 @@ public class ApplicationManager implements XmlRpcHandler {
Application app; Application app;
private ContextHandler staticContext = null; private ContextHandler staticContext = null;
private ContextHandler appContext = null; private ServletContextHandler appContext = null;
String appName; String appName;
File appDir; File appDir;
@ -477,7 +477,7 @@ public class ApplicationManager implements XmlRpcHandler {
// bind to Jetty HTTP server // bind to Jetty HTTP server
if (jetty != null) { if (jetty != null) {
if(context == null) { if (context == null) {
context = new ContextHandlerCollection(); context = new ContextHandlerCollection();
jetty.getHttpServer().setHandler(context); jetty.getHttpServer().setHandler(context);
} }
@ -499,18 +499,13 @@ public class ApplicationManager implements XmlRpcHandler {
staticContext.start(); staticContext.start();
} }
appContext = context.addContext(pathPattern, "");
ServletHandler handler = new ServletHandler(); appContext = new ServletContextHandler(context, pathPattern, true, true);
Class servletClass = servletClassName == null ? Class servletClass = servletClassName == null ?
EmbeddedServletClient.class : Class.forName(servletClassName); EmbeddedServletClient.class : Class.forName(servletClassName);
ServletHolder holder = new ServletHolder(servletClass); ServletHolder holder = new ServletHolder(servletClass);
handler.addServletWithMapping(holder, "/*");
holder.setInitParameter("application", appName); holder.setInitParameter("application", appName);
// holder.setInitParameter("mountpoint", mountpoint); appContext.addServlet(holder, "/*");
if (cookieDomain != null) { if (cookieDomain != null) {
holder.setInitParameter("cookieDomain", cookieDomain); holder.setInitParameter("cookieDomain", cookieDomain);
@ -536,8 +531,6 @@ public class ApplicationManager implements XmlRpcHandler {
holder.setInitParameter("debug", debug); holder.setInitParameter("debug", debug);
} }
appContext.setHandler(handler);
if (protectedStaticDir != null) { if (protectedStaticDir != null) {
File protectedContent = getAbsoluteFile(protectedStaticDir); File protectedContent = getAbsoluteFile(protectedStaticDir);
appContext.setResourceBase(protectedContent.getPath()); appContext.setResourceBase(protectedContent.getPath());

View file

@ -17,11 +17,11 @@
package helma.main; package helma.main;
import org.mortbay.jetty.Connector; import org.eclipse.jetty.server.Connector;
import org.mortbay.jetty.ajp.Ajp13SocketConnector; import org.eclipse.jetty.server.HttpConfiguration;
import org.mortbay.jetty.bio.SocketConnector; import org.eclipse.jetty.server.HttpConnectionFactory;
import org.mortbay.jetty.nio.SelectChannelConnector; import org.eclipse.jetty.server.ServerConnector;
import org.mortbay.xml.XmlConfiguration; import org.eclipse.jetty.xml.XmlConfiguration;
import java.net.URL; import java.net.URL;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -31,29 +31,25 @@ import java.io.File;
public class JettyServer { public class JettyServer {
// the embedded web server // the embedded web server
protected org.mortbay.jetty.Server http; 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 { public static JettyServer init(Server server, ServerConfig config) throws IOException {
File configFile = config.getConfigFile(); File configFile = config.getConfigFile();
if (configFile != null && configFile.exists()) { if (configFile != null && configFile.exists()) {
return new JettyServer(configFile.toURI().toURL()); return new JettyServer(configFile.toURI().toURL());
} else if (config.hasWebsrvPort() || config.hasAjp13Port()) { } else if (config.hasWebsrvPort()) {
return new JettyServer(config.getWebsrvPort(), config.getAjp13Port(), server); return new JettyServer(config.getWebsrvPort(), server);
} }
return null; return null;
} }
private JettyServer(URL url) throws IOException { private JettyServer(URL url) throws IOException {
http = new org.mortbay.jetty.Server(); http = new org.eclipse.jetty.server.Server();
try { try {
XmlConfiguration config = new XmlConfiguration(url); XmlConfiguration config = new XmlConfiguration(url);
config.configure(http); config.configure(http);
openListeners();
} catch (IOException e) { } catch (IOException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
@ -61,60 +57,42 @@ public class JettyServer {
} }
} }
private JettyServer(InetSocketAddress webPort, InetSocketAddress ajpPort, Server server) private JettyServer(InetSocketAddress webPort, Server server)
throws IOException { throws IOException {
http = new org.mortbay.jetty.Server(); http = new org.eclipse.jetty.server.Server();
http.setServer(http);
// start embedded web server if port is specified // start embedded web server if port is specified
if (webPort != null) { if (webPort != null) {
Connector conn = new SelectChannelConnector(); HttpConfiguration httpConfig = new HttpConfiguration();
conn.setHost(webPort.getAddress().getHostAddress()); httpConfig.setSendServerVersion(false);
conn.setPort(webPort.getPort()); httpConfig.setSendDateHeader(false);
HttpConnectionFactory connectionFactory = new HttpConnectionFactory(httpConfig);
http.addConnector(conn);
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.mortbay.jetty.Server getHttpServer() { public org.eclipse.jetty.server.Server getHttpServer() {
return http; return http;
} }
public void start() throws Exception { public void start() throws Exception {
openListeners();
http.start(); http.start();
if (ajp13 != null) {
ajp13.start();
}
} }
public void stop() throws Exception { public void stop() throws Exception {
http.stop(); http.stop();
if (ajp13 != null) {
ajp13.stop();
}
} }
public void destroy() { public void destroy() {
@ -127,7 +105,7 @@ public class JettyServer {
// while start() will be called with the user we will actually run as // while start() will be called with the user we will actually run as
Connector[] connectors = http.getConnectors(); Connector[] connectors = http.getConnectors();
for (int i = 0; i < connectors.length; i++) { for (int i = 0; i < connectors.length; i++) {
connectors[i].open(); ((ServerConnector) connectors[i]).open();
} }
} }
} }

View file

@ -26,8 +26,6 @@ import org.apache.commons.logging.LogFactory;
import org.apache.xmlrpc.*; import org.apache.xmlrpc.*;
import java.io.*; import java.io.*;
import java.rmi.registry.*;
import java.rmi.server.*;
import java.util.*; import java.util.*;
import java.net.*; 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) { if (!config.hasXmlrpcPort() && sysProps.getProperty("xmlrpcPort") != null) {
try { try {
config.setXmlrpcPort(getInetSocketAddress(sysProps.getProperty("xmlrpcPort"))); config.setXmlrpcPort(getInetSocketAddress(sysProps.getProperty("xmlrpcPort")));
@ -242,12 +232,6 @@ public class Server implements Runnable {
} catch (Exception portx) { } catch (Exception portx) {
throw new Exception("Error parsing web server port property: " + 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)) { } else if (args[i].equals("-c") && ((i + 1) < args.length)) {
config.setConfigFile(new File(args[++i])); 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)) {
@ -320,7 +304,6 @@ public class Server implements Runnable {
System.out.println(" -c jetty.xml Specify Jetty XML configuration 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(""); System.out.println("");
System.out.println("Supported formats for server ports:"); System.out.println("Supported formats for server ports:");
System.out.println(" <port-number>"); System.out.println(" <port-number>");
@ -348,9 +331,6 @@ public class Server implements Runnable {
checkPort(config.getXmlrpcPort()); checkPort(config.getXmlrpcPort());
} }
if (config.hasAjp13Port()) {
checkPort(config.getAjp13Port());
}
} catch (Exception running) { } catch (Exception running) {
System.out.println(running.getMessage()); System.out.println(running.getMessage());
System.exit(1); System.exit(1);
@ -598,6 +578,9 @@ public class Server implements Runnable {
logger.error("Error setting security manager", x); logger.error("Error setting security manager", x);
} }
// start applications
appManager.startAll();
// start embedded web server // start embedded web server
if (jetty != null) { if (jetty != null) {
try { try {
@ -607,9 +590,6 @@ public class Server implements Runnable {
} }
} }
// start applications
appManager.startAll();
while (Thread.currentThread() == mainThread) { while (Thread.currentThread() == mainThread) {
try { try {
Thread.sleep(3000L); Thread.sleep(3000L);

View file

@ -27,7 +27,6 @@ public class ServerConfig {
private InetSocketAddress xmlrpcPort = null; private InetSocketAddress xmlrpcPort = null;
private InetSocketAddress websrvPort = null; private InetSocketAddress websrvPort = null;
private InetSocketAddress ajp13Port = null;
private File propFile = null; private File propFile = null;
private File homeDir = null; private File homeDir = null;
private File configFile = null; private File configFile = null;
@ -53,10 +52,6 @@ public class ServerConfig {
return (websrvPort != null); return (websrvPort != null);
} }
public boolean hasAjp13Port() {
return (ajp13Port != null);
}
public boolean hasApps() { public boolean hasApps() {
return (apps != null); return (apps != null);
} }
@ -77,14 +72,6 @@ public class ServerConfig {
this.websrvPort = websrvPort; this.websrvPort = websrvPort;
} }
public InetSocketAddress getAjp13Port() {
return ajp13Port;
}
public void setAjp13Port(InetSocketAddress ajp13Port) {
this.ajp13Port = ajp13Port;
}
public File getPropFile() { public File getPropFile() {
return propFile; return propFile;
} }

View file

@ -35,15 +35,17 @@ import java.util.ArrayList;
*/ */
public class Main { public class Main {
public static final String[] jars = { public static final String[] jars = {
"helma.jar", "rhino.jar", "jetty.jar", "helma.jar", "rhino.jar",
"jetty-util.jar", "jetty-ajp.jar", "jetty-server.jar", "jetty-io.jar", "jetty-http.jar",
"commons-logging.jar", "crimson.jar", "jetty-security.jar", "jetty-xml.jar",
"xmlrpc.jar", "servlet.jar", "jetty-servlet.jar", "jetty-util.jar",
"mail.jar", "activation.jar", "commons-logging.jar",
"commons-fileupload.jar", "commons-codec.jar", "xmlrpc.jar", "servlet.jar",
"commons-io.jar", "commons-net.jar", "mail.jar", "activation.jar",
"tagsoup.jar" "commons-fileupload.jar", "commons-codec.jar",
}; "commons-io.jar", "commons-net.jar",
"tagsoup.jar"
};
private Class serverClass; private Class serverClass;
private Object server; private Object server;

View file

@ -66,12 +66,12 @@ public class Logging extends LogFactory {
// normalize log name // normalize log name
logname = logname.replaceAll("[^\\w\\d\\.]", ""); logname = logname.replaceAll("[^\\w\\d\\.]", "");
if ("console".equals(logdir)) { if ("console".equals(logdir)) {
if (logname.startsWith("org.mortbay.")) if (logname.startsWith("org.eclipse.jetty."))
return getConsoleLog().getSedatedLog(); return getConsoleLog().getSedatedLog();
else else
return getConsoleLog(); return getConsoleLog();
} else { } else {
if (logname.startsWith("org.mortbay.")) if (logname.startsWith("org.eclipse.jetty."))
return getFileLog(logname).getSedatedLog(); return getFileLog(logname).getSedatedLog();
else else
return getFileLog(logname); return getFileLog(logname);