diff --git a/rest/rest-server/src/main/webapp/WEB-INF/web.xml b/rest/rest-server/src/main/webapp/WEB-INF/web.xml
index d682fce4ba..ce45cd7cd0 100644
--- a/rest/rest-server/src/main/webapp/WEB-INF/web.xml
+++ b/rest/rest-server/src/main/webapp/WEB-INF/web.xml
@@ -65,6 +65,33 @@
org.atmosphere.cache.UUIDBroadcasterCache
+
+
+ org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults
+ true
+
+
+ org.atmosphere.cpr.AtmosphereInterceptor.disable
+ true
+
+
+ org.atmosphere.cpr.AtmosphereInitializer.disabled
+ true
+
+
+ org.atmosphere.cpr.scanClassPath
+ false
+
+
+ org.atmosphere.disableOnStateEvent
+ true
+
+
+ org.atmosphere.interceptor.JavaScriptProtocol.enforceAtmosphereProtocol
+ true
+
+
+
0
true
diff --git a/scheduler/scheduler-server/build.gradle b/scheduler/scheduler-server/build.gradle
index 34afb20249..654e7f6b7f 100644
--- a/scheduler/scheduler-server/build.gradle
+++ b/scheduler/scheduler-server/build.gradle
@@ -19,6 +19,8 @@ dependencies {
compile "org.ow2.proactive:emailnotification-addons:${schedulingVersion}"
compile 'org.eclipse.jetty:jetty-webapp:9.2.24.v20180105'
+ compile 'org.eclipse.jetty:jetty-quickstart:9.2.24.v20180105'
+
compile "org.objectweb.proactive:programming-core:${programmingVersion}"
compile project(':common:common-api')
@@ -33,8 +35,6 @@ dependencies {
compile project(':rest:rest-server')
-
-
testCompile "com.google.jimfs:jimfs:1.1"
testCompile "org.objectweb.proactive:programming-extension-pnp:${programmingVersion}"
testCompile "org.objectweb.proactive:programming-extension-pnpssl:${programmingVersion}"
diff --git a/scheduler/scheduler-server/src/main/java/org/ow2/proactive/utils/JettyStarter.java b/scheduler/scheduler-server/src/main/java/org/ow2/proactive/utils/JettyStarter.java
index 3ab4a5b786..553de33b15 100644
--- a/scheduler/scheduler-server/src/main/java/org/ow2/proactive/utils/JettyStarter.java
+++ b/scheduler/scheduler-server/src/main/java/org/ow2/proactive/utils/JettyStarter.java
@@ -26,7 +26,6 @@
package org.ow2.proactive.utils;
import java.io.File;
-import java.io.FilenameFilter;
import java.net.BindException;
import java.util.ArrayList;
import java.util.List;
@@ -35,6 +34,7 @@
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
import org.eclipse.jetty.http.HttpVersion;
+import org.eclipse.jetty.quickstart.QuickStartWebApp;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
@@ -60,7 +60,7 @@
public class JettyStarter {
- protected static final String FOLDER_TO_DEPLOY = "/dist/war/";
+ private static final String FOLDER_TO_DEPLOY = "/dist/war/";
public static final String HTTP_CONNECTOR_NAME = "http";
@@ -207,26 +207,29 @@ public Server createHttpServer(int httpPort, int httpsPort, boolean httpsEnabled
secureHttpConfiguration.setSendServerVersion(false);
// Connector to listen for HTTPS requests
- ServerConnector httpsConnector = new ServerConnector(server,
- new SslConnectionFactory(sslContextFactory,
- HttpVersion.HTTP_1_1.toString()),
- new HttpConnectionFactory(secureHttpConfiguration));
- httpsConnector.setName(HTTPS_CONNECTOR_NAME);
- httpsConnector.setPort(httpsPort);
- httpsConnector.setIdleTimeout(WebProperties.WEB_IDLE_TIMEOUT.getValueAsLong());
-
- if (redirectHttpToHttps) {
- // The next two settings allow !403 errors to be redirected to HTTPS
- httpConfiguration.setSecureScheme("https");
- httpConfiguration.setSecurePort(httpsPort);
-
- // Connector to listen for HTTP requests that are redirected to HTTPS
- ServerConnector httpConnector = createHttpConnector(server, httpConfiguration, httpPort);
-
- connectors = new Connector[] { httpConnector, httpsConnector };
- } else {
- connectors = new Connector[] { httpsConnector };
+ try (ServerConnector httpsConnector = new ServerConnector(server,
+ new SslConnectionFactory(sslContextFactory,
+ HttpVersion.HTTP_1_1.toString()),
+ new HttpConnectionFactory(secureHttpConfiguration))) {
+
+ httpsConnector.setName(HTTPS_CONNECTOR_NAME);
+ httpsConnector.setPort(httpsPort);
+ httpsConnector.setIdleTimeout(WebProperties.WEB_IDLE_TIMEOUT.getValueAsLong());
+
+ if (redirectHttpToHttps) {
+ // The next two settings allow !403 errors to be redirected to HTTPS
+ httpConfiguration.setSecureScheme("https");
+ httpConfiguration.setSecurePort(httpsPort);
+
+ // Connector to listen for HTTP requests that are redirected to HTTPS
+ ServerConnector httpConnector = createHttpConnector(server, httpConfiguration, httpPort);
+
+ connectors = new Connector[] { httpConnector, httpsConnector };
+ } else {
+ connectors = new Connector[] { httpsConnector };
+ }
}
+
} else {
ServerConnector httpConnector = createHttpConnector(server, httpConfiguration, httpPort);
httpConnector.setIdleTimeout(WebProperties.WEB_IDLE_TIMEOUT.getValueAsLong());
@@ -277,7 +280,7 @@ private List startServer(Server server, String schedulerHost, int restPo
}
private String getApplicationUrl(String httpProtocol, String schedulerHost, int restPort,
- WebAppContext webAppContext) {
+ QuickStartWebApp webAppContext) {
return httpProtocol + "://" + schedulerHost + ":" + restPort + webAppContext.getContextPath();
}
@@ -287,11 +290,11 @@ private List printDeployedApplications(Server server, String schedulerHo
ArrayList applicationsUrls = new ArrayList<>();
if (handlerList.getHandlers() != null) {
for (Handler handler : handlerList.getHandlers()) {
- if (!(handler instanceof WebAppContext)) {
+ if (!(handler instanceof QuickStartWebApp)) {
continue;
}
- WebAppContext webAppContext = (WebAppContext) handler;
+ QuickStartWebApp webAppContext = (QuickStartWebApp) handler;
Throwable startException = webAppContext.getUnavailableException();
if (startException == null) {
if (!"/".equals(webAppContext.getContextPath())) {
@@ -330,7 +333,7 @@ private void addWarsToHandlerList(HandlerList handlerList, String[] virtualHost)
private void addWarFile(HandlerList handlerList, File file, String[] virtualHost) {
String contextPath = "/" + FilenameUtils.getBaseName(file.getName());
- WebAppContext webApp = createWebAppContext(contextPath, virtualHost);
+ WebAppContext webApp = createWebAppContext(contextPath, virtualHost, true);
webApp.setWar(file.getAbsolutePath());
handlerList.addHandler(webApp);
logger.debug("Deploying " + contextPath + " using war file " + file);
@@ -338,13 +341,12 @@ private void addWarFile(HandlerList handlerList, File file, String[] virtualHost
private void addExplodedWebApp(HandlerList handlerList, File file, String[] virtualHost) {
String contextPath = "/" + file.getName();
- WebAppContext webApp = createWebAppContext(contextPath, virtualHost);
+ WebAppContext webApp = createWebAppContext(contextPath, virtualHost, true);
// Don't scan classes for annotations. Saves 1 second at startup.
webApp.setAttribute("org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern", "^$");
webApp.setAttribute("org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern", "^$");
- webApp.setDescriptor(new File(file, "/WEB-INF/web.xml").getAbsolutePath());
webApp.setResourceBase(file.getAbsolutePath());
handlerList.addHandler(webApp);
logger.debug("Deploying " + contextPath + " using exploded war " + file);
@@ -352,7 +354,7 @@ private void addExplodedWebApp(HandlerList handlerList, File file, String[] virt
private void addStaticFolder(HandlerList handlerList, File file, String[] virtualHost) {
String contextPath = "/" + file.getName();
- WebAppContext webApp = createWebAppContext(contextPath, virtualHost);
+ WebAppContext webApp = createWebAppContext(contextPath, virtualHost, false);
webApp.setWar(file.getAbsolutePath());
handlerList.addHandler(webApp);
logger.debug("Deploying " + contextPath + " using folder " + file);
@@ -361,14 +363,26 @@ private void addStaticFolder(HandlerList handlerList, File file, String[] virtua
private void addGetStartedApplication(HandlerList handlerList, File file, String[] virtualHost) {
if (file.exists()) {
String contextPath = "/";
- WebAppContext webApp = createWebAppContext(contextPath, virtualHost);
+ WebAppContext webApp = createWebAppContext(contextPath, virtualHost, false);
webApp.setWar(file.getAbsolutePath());
handlerList.addHandler(webApp);
}
}
- private WebAppContext createWebAppContext(String contextPath, String[] virtualHost) {
- WebAppContext webApp = new WebAppContext();
+ private WebAppContext createWebAppContext(String contextPath, String[] virtualHost, boolean quickstart) {
+
+ WebAppContext webApp;
+ if (quickstart) {
+ webApp = new QuickStartWebApp();
+
+ // Parameters that may optimize webapp deployment
+ ((QuickStartWebApp) webApp).setAutoPreconfigure(true);
+ webApp.setInitParameter("org.eclipse.jetty.jsp.precompiled", "true");
+
+ } else {
+ webApp = new WebAppContext();
+ }
+
webApp.setParentLoaderPriority(true);
// The following setting allows to avoid conflicts between server jackson jars and individual war jackson versions.
webApp.addServerClass("com.fasterxml.jackson.");