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 org.apache.xmlrpc.XmlRpcHandler;
import org.apache.commons.logging.Log;
import org.mortbay.jetty.handler.ContextHandler;
import org.mortbay.jetty.handler.ContextHandlerCollection;
import org.mortbay.jetty.handler.ResourceHandler;
import org.mortbay.jetty.servlet.ServletHandler;
import org.mortbay.jetty.servlet.ServletHolder;
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.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import java.io.*;
import java.util.*;
@ -304,7 +304,7 @@ public class ApplicationManager implements XmlRpcHandler {
Application app;
private ContextHandler staticContext = null;
private ContextHandler appContext = null;
private ServletContextHandler appContext = null;
String appName;
File appDir;
@ -500,17 +500,12 @@ public class ApplicationManager implements XmlRpcHandler {
staticContext.start();
}
appContext = context.addContext(pathPattern, "");
ServletHandler handler = new ServletHandler();
appContext = new ServletContextHandler(context, pathPattern, true, true);
Class servletClass = servletClassName == null ?
EmbeddedServletClient.class : Class.forName(servletClassName);
ServletHolder holder = new ServletHolder(servletClass);
handler.addServletWithMapping(holder, "/*");
holder.setInitParameter("application", appName);
// holder.setInitParameter("mountpoint", mountpoint);
appContext.addServlet(holder, "/*");
if (cookieDomain != null) {
holder.setInitParameter("cookieDomain", cookieDomain);
@ -536,8 +531,6 @@ public class ApplicationManager implements XmlRpcHandler {
holder.setInitParameter("debug", debug);
}
appContext.setHandler(handler);
if (protectedStaticDir != null) {
File protectedContent = getAbsoluteFile(protectedStaticDir);
appContext.setResourceBase(protectedContent.getPath());

View file

@ -17,11 +17,11 @@
package helma.main;
import org.mortbay.jetty.Connector;
import org.mortbay.jetty.ajp.Ajp13SocketConnector;
import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.xml.XmlConfiguration;
import org.eclipse.jetty.server.Connector;
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;
import java.net.InetSocketAddress;
@ -31,29 +31,25 @@ import java.io.File;
public class JettyServer {
// the embedded web server
protected org.mortbay.jetty.Server http;
// the AJP13 Listener, used for connecting from external webserver to servlet via JK
protected Ajp13SocketConnector ajp13;
protected org.eclipse.jetty.server.Server http;
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;
}
private JettyServer(URL url) throws IOException {
http = new org.mortbay.jetty.Server();
http = new org.eclipse.jetty.server.Server();
try {
XmlConfiguration config = new XmlConfiguration(url);
config.configure(http);
openListeners();
} catch (IOException e) {
throw 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 {
http = new org.mortbay.jetty.Server();
http.setServer(http);
http = new org.eclipse.jetty.server.Server();
// start embedded web server if port is specified
if (webPort != null) {
Connector conn = new SelectChannelConnector();
conn.setHost(webPort.getAddress().getHostAddress());
conn.setPort(webPort.getPort());
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSendServerVersion(false);
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;
}
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();
}
}
}

View file

@ -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);
@ -598,6 +578,9 @@ public class Server implements Runnable {
logger.error("Error setting security manager", x);
}
// start applications
appManager.startAll();
// start embedded web server
if (jetty != null) {
try {
@ -607,9 +590,6 @@ public class Server implements Runnable {
}
}
// start applications
appManager.startAll();
while (Thread.currentThread() == mainThread) {
try {
Thread.sleep(3000L);

View file

@ -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;
}

View file

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

View file

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