diff --git a/build.gradle b/build.gradle index 8f22cf89..02931d7f 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/lib/javax.servlet-3.0.0.v201112011016.jar b/lib/javax.servlet-3.0.0.v201112011016.jar deleted file mode 100644 index b1354096..00000000 Binary files a/lib/javax.servlet-3.0.0.v201112011016.jar and /dev/null differ diff --git a/lib/jetty-ajp-8.1.22.v20160922.jar b/lib/jetty-ajp-8.1.22.v20160922.jar deleted file mode 100644 index bfc440ea..00000000 Binary files a/lib/jetty-ajp-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-continuation-8.1.22.v20160922.jar b/lib/jetty-continuation-8.1.22.v20160922.jar deleted file mode 100644 index e190402d..00000000 Binary files a/lib/jetty-continuation-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-http-8.1.22.v20160922.jar b/lib/jetty-http-8.1.22.v20160922.jar deleted file mode 100644 index 819714f8..00000000 Binary files a/lib/jetty-http-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-http-9.4.3.v20170317.jar b/lib/jetty-http-9.4.3.v20170317.jar new file mode 100644 index 00000000..23ab219f Binary files /dev/null and b/lib/jetty-http-9.4.3.v20170317.jar differ diff --git a/lib/jetty-io-8.1.22.v20160922.jar b/lib/jetty-io-8.1.22.v20160922.jar deleted file mode 100644 index 9df3bfae..00000000 Binary files a/lib/jetty-io-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-io-9.4.3.v20170317.jar b/lib/jetty-io-9.4.3.v20170317.jar new file mode 100644 index 00000000..9054dec1 Binary files /dev/null and b/lib/jetty-io-9.4.3.v20170317.jar differ diff --git a/lib/jetty-security-8.1.22.v20160922.jar b/lib/jetty-security-8.1.22.v20160922.jar deleted file mode 100644 index 1692abd8..00000000 Binary files a/lib/jetty-security-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-security-9.4.3.v20170317.jar b/lib/jetty-security-9.4.3.v20170317.jar new file mode 100644 index 00000000..b3902d87 Binary files /dev/null and b/lib/jetty-security-9.4.3.v20170317.jar differ diff --git a/lib/jetty-server-8.1.22.v20160922.jar b/lib/jetty-server-8.1.22.v20160922.jar deleted file mode 100644 index c875d4fc..00000000 Binary files a/lib/jetty-server-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-server-9.4.3.v20170317.jar b/lib/jetty-server-9.4.3.v20170317.jar new file mode 100644 index 00000000..fe209d0c Binary files /dev/null and b/lib/jetty-server-9.4.3.v20170317.jar differ diff --git a/lib/jetty-servlet-8.1.22.v20160922.jar b/lib/jetty-servlet-8.1.22.v20160922.jar deleted file mode 100644 index e624ce9f..00000000 Binary files a/lib/jetty-servlet-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-servlet-9.4.3.v20170317.jar b/lib/jetty-servlet-9.4.3.v20170317.jar new file mode 100644 index 00000000..6524bc0f Binary files /dev/null and b/lib/jetty-servlet-9.4.3.v20170317.jar differ diff --git a/lib/jetty-util-8.1.22.v20160922.jar b/lib/jetty-util-8.1.22.v20160922.jar deleted file mode 100644 index 4a28db96..00000000 Binary files a/lib/jetty-util-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-util-9.4.3.v20170317.jar b/lib/jetty-util-9.4.3.v20170317.jar new file mode 100644 index 00000000..10a4a7e2 Binary files /dev/null and b/lib/jetty-util-9.4.3.v20170317.jar differ diff --git a/lib/jetty-xml-8.1.22.v20160922.jar b/lib/jetty-xml-8.1.22.v20160922.jar deleted file mode 100644 index ec605ae8..00000000 Binary files a/lib/jetty-xml-8.1.22.v20160922.jar and /dev/null differ diff --git a/lib/jetty-xml-9.4.3.v20170317.jar b/lib/jetty-xml-9.4.3.v20170317.jar new file mode 100644 index 00000000..58e8061b Binary files /dev/null and b/lib/jetty-xml-9.4.3.v20170317.jar differ diff --git a/src/helma/main/ApplicationManager.java b/src/helma/main/ApplicationManager.java index 10ff61b7..ae4d7fe7 100644 --- a/src/helma/main/ApplicationManager.java +++ b/src/helma/main/ApplicationManager.java @@ -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()); diff --git a/src/helma/main/JettyServer.java b/src/helma/main/JettyServer.java index aa1257be..88ba8c10 100644 --- a/src/helma/main/JettyServer.java +++ b/src/helma/main/JettyServer.java @@ -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()); + 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.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(); } } } diff --git a/src/helma/main/Server.java b/src/helma/main/Server.java index 1ddf8584..38ba0d66 100644 --- a/src/helma/main/Server.java +++ b/src/helma/main/Server.java @@ -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(" "); @@ -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); diff --git a/src/helma/main/ServerConfig.java b/src/helma/main/ServerConfig.java index 6ce25592..125601c2 100644 --- a/src/helma/main/ServerConfig.java +++ b/src/helma/main/ServerConfig.java @@ -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; } diff --git a/src/helma/main/launcher/Main.java b/src/helma/main/launcher/Main.java index 6ed02900..f72137ad 100644 --- a/src/helma/main/launcher/Main.java +++ b/src/helma/main/launcher/Main.java @@ -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; diff --git a/src/helma/util/Logging.java b/src/helma/util/Logging.java index 7e9b4265..4a233f0b 100644 --- a/src/helma/util/Logging.java +++ b/src/helma/util/Logging.java @@ -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); } }