diff --git a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java
index 50384666f53..9e5bba5d4ee 100644
--- a/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java
+++ b/jetty-nosql/src/main/java/org/eclipse/jetty/nosql/mongodb/MongoSessionManager.java
@@ -399,8 +399,8 @@ public class MongoSessionManager extends NoSqlSessionManager
// cleanup, remove values from session, that don't exist in data anymore:
for (String str : session.getNames())
{
- if (!attrs.keySet().contains(str))
- {
+ if (!attrs.keySet().contains(encodeName(str)))
+ {
session.doPutOrRemove(str,null);
session.unbindValue(str,session.getAttribute(str));
}
diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java
index 09bb4ccdbd0..ca3f027bdeb 100644
--- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java
+++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessor.java
@@ -892,7 +892,7 @@ public class PlusDescriptorProcessor extends IterativeDescriptorProcessor
if (defaultNE!=null)
defaultNE.bindToENC(name);
else
- throw new IllegalStateException("Nothing to bind for name "+nameInEnvironment);
+ throw new IllegalStateException("Nothing to bind for name " + name);
}
diff --git a/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessorTest.java b/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessorTest.java
index c6ff2f7b3ac..8199afd19d3 100644
--- a/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessorTest.java
+++ b/jetty-plus/src/test/java/org/eclipse/jetty/plus/webapp/PlusDescriptorProcessorTest.java
@@ -19,6 +19,7 @@
package org.eclipse.jetty.plus.webapp;
+import java.lang.reflect.InvocationTargetException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -50,6 +51,7 @@ public class PlusDescriptorProcessorTest
protected FragmentDescriptor fragDescriptor1;
protected FragmentDescriptor fragDescriptor2;
protected FragmentDescriptor fragDescriptor3;
+ protected FragmentDescriptor fragDescriptor4;
protected WebAppContext context;
/**
* @throws java.lang.Exception
@@ -81,6 +83,9 @@ public class PlusDescriptorProcessorTest
URL frag3Xml = Thread.currentThread().getContextClassLoader().getResource("web-fragment-3.xml");
fragDescriptor3 = new FragmentDescriptor(org.eclipse.jetty.util.resource.Resource.newResource(frag3Xml));
fragDescriptor3.parse();
+ URL frag4Xml = Thread.currentThread().getContextClassLoader().getResource("web-fragment-4.xml");
+ fragDescriptor4 = new FragmentDescriptor(org.eclipse.jetty.util.resource.Resource.newResource(frag4Xml));
+ fragDescriptor4.parse();
}
@After
@@ -94,6 +99,32 @@ public class PlusDescriptorProcessorTest
Thread.currentThread().setContextClassLoader(oldLoader);
}
+ @Test
+ public void testMissingResourceDeclaration()
+ throws Exception
+ {
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(context.getClassLoader());
+
+ try
+ {
+ PlusDescriptorProcessor pdp = new PlusDescriptorProcessor();
+ pdp.process(context, fragDescriptor4);
+ fail("Expected missing resource declaration");
+ }
+ catch (InvocationTargetException ex)
+ {
+ Throwable cause = ex.getCause();
+ assertNotNull(cause);
+ assertNotNull(cause.getMessage());
+ assertTrue(cause.getMessage().contains("jdbc/mymissingdatasource"));
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ }
+
@Test
public void testWebXmlResourceDeclarations()
throws Exception
diff --git a/jetty-plus/src/test/resources/web-fragment-4.xml b/jetty-plus/src/test/resources/web-fragment-4.xml
new file mode 100644
index 00000000000..c2158ea156a
--- /dev/null
+++ b/jetty-plus/src/test/resources/web-fragment-4.xml
@@ -0,0 +1,16 @@
+
+
+
+ * Using information present in the {@link HttpConfiguration}, will attempt to redirect to the {@link HttpConfiguration#getSecureScheme()} and
+ * {@link HttpConfiguration#getSecurePort()} for any request that {@link HttpServletRequest#isSecure()} == false.
+ */
+public class SecuredRedirectHandler extends AbstractHandler
+{
+ @Override
+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+ {
+ HttpConfiguration httpConfig = HttpChannel.getCurrentHttpChannel().getHttpConfiguration();
+
+ if (baseRequest.isSecure())
+ {
+ return; // all done
+ }
+
+ if (httpConfig.getSecurePort() > 0)
+ {
+ String scheme = httpConfig.getSecureScheme();
+ int port = httpConfig.getSecurePort();
+
+ String url = URIUtil.newURI(scheme,baseRequest.getServerName(),port,baseRequest.getRequestURI(),baseRequest.getQueryString());
+ response.setContentLength(0);
+ response.sendRedirect(url);
+ }
+ else
+ {
+ response.sendError(HttpStatus.FORBIDDEN_403,"Not Secure");
+ }
+ baseRequest.setHandled(true);
+ }
+}
\ No newline at end of file
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java
index 53ccd6398e1..5bcac2c2851 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java
@@ -85,8 +85,9 @@ public class HashSessionManager extends AbstractSessionManager
}
finally
{
- if (_timer != null && _timer.isRunning())
- _timer.schedule(this, _scavengePeriodMs, TimeUnit.MILLISECONDS);
+ if (_timer != null && _timer.isRunning()) {
+ _task = _timer.schedule(this, _scavengePeriodMs, TimeUnit.MILLISECONDS);
+ }
}
}
}
@@ -111,7 +112,7 @@ public class HashSessionManager extends AbstractSessionManager
finally
{
if (_timer != null && _timer.isRunning())
- _timer.schedule(this, _savePeriodMs, TimeUnit.MILLISECONDS);
+ _saveTask = _timer.schedule(this, _savePeriodMs, TimeUnit.MILLISECONDS);
}
}
}
@@ -138,7 +139,7 @@ public class HashSessionManager extends AbstractSessionManager
ServletContext context = ContextHandler.getCurrentContext();
if (context!=null)
_timer = (Scheduler)context.getAttribute("org.eclipse.jetty.server.session.timer");
- }
+ }
if (_timer == null)
{
@@ -148,7 +149,7 @@ public class HashSessionManager extends AbstractSessionManager
}
else
addBean(_timer,false);
-
+
super.doStart();
setScavengePeriod(getScavengePeriod());
@@ -177,12 +178,15 @@ public class HashSessionManager extends AbstractSessionManager
{
if (_saveTask!=null)
_saveTask.cancel();
+
_saveTask=null;
if (_task!=null)
_task.cancel();
+
_task=null;
_timer=null;
}
+
// This will callback invalidate sessions - where we decide if we will save
super.doStop();
@@ -314,6 +318,7 @@ public class HashSessionManager extends AbstractSessionManager
_task.cancel();
_task = null;
}
+
_task = _timer.schedule(new Scavenger(),_scavengePeriodMs, TimeUnit.MILLISECONDS);
}
}
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java
index 434cf9dfde7..f633e5b93c7 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/session/JDBCSessionIdManager.java
@@ -604,7 +604,7 @@ public class JDBCSessionIdManager extends AbstractSessionIdManager
finally
{
if (_scheduler != null && _scheduler.isRunning())
- _scheduler.schedule(this, _scavengeIntervalMs, TimeUnit.MILLISECONDS);
+ _task = _scheduler.schedule(this, _scavengeIntervalMs, TimeUnit.MILLISECONDS);
}
}
}
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AllowAllVerifier.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AllowAllVerifier.java
new file mode 100644
index 00000000000..0c203076f3e
--- /dev/null
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/AllowAllVerifier.java
@@ -0,0 +1,31 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.server.handler;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+
+public class AllowAllVerifier implements HostnameVerifier
+{
+ @Override
+ public boolean verify(String hostname, SSLSession session)
+ {
+ return true;
+ }
+}
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java
new file mode 100644
index 00000000000..ebcf20a1e5b
--- /dev/null
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/handler/SecuredRedirectHandlerTest.java
@@ -0,0 +1,288 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.server.handler;
+
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URL;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSocketFactory;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.server.Connector;
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.HttpConfiguration;
+import org.eclipse.jetty.server.HttpConnectionFactory;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.SecureRequestCustomizer;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.eclipse.jetty.server.SslConnectionFactory;
+import org.eclipse.jetty.toolchain.test.IO;
+import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
+import org.eclipse.jetty.util.ssl.SslContextFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class SecuredRedirectHandlerTest
+{
+ private static Server server;
+ private static HostnameVerifier origVerifier;
+ private static SSLSocketFactory origSsf;
+ private static URI serverHttpUri;
+ private static URI serverHttpsUri;
+
+ @BeforeClass
+ public static void startServer() throws Exception
+ {
+ // Setup SSL
+ File keystore = MavenTestingUtils.getTestResourceFile("keystore");
+ SslContextFactory sslContextFactory = new SslContextFactory();
+ sslContextFactory.setKeyStorePath(keystore.getAbsolutePath());
+ sslContextFactory.setKeyStorePassword("storepwd");
+ sslContextFactory.setKeyManagerPassword("keypwd");
+ sslContextFactory.setTrustStorePath(keystore.getAbsolutePath());
+ sslContextFactory.setTrustStorePassword("storepwd");
+
+ server = new Server();
+
+ int port = 12080;
+ int securePort = 12443;
+
+ // Setup HTTP Configuration
+ HttpConfiguration httpConf = new HttpConfiguration();
+ httpConf.setSecurePort(securePort);
+ httpConf.setSecureScheme("https");
+
+ ServerConnector httpConnector = new ServerConnector(server,new HttpConnectionFactory(httpConf));
+ httpConnector.setName("unsecured");
+ httpConnector.setPort(port);
+
+ // Setup HTTPS Configuration
+ HttpConfiguration httpsConf = new HttpConfiguration(httpConf);
+ httpsConf.addCustomizer(new SecureRequestCustomizer());
+
+ ServerConnector httpsConnector = new ServerConnector(server,new SslConnectionFactory(sslContextFactory,"http/1.1"),new HttpConnectionFactory(httpsConf));
+ httpsConnector.setName("secured");
+ httpsConnector.setPort(securePort);
+
+ // Add connectors
+ server.setConnectors(new Connector[] { httpConnector, httpsConnector });
+
+ // Wire up contexts
+ String secureHosts[] = new String[] { "@secured" };
+
+ ContextHandler test1Context = new ContextHandler();
+ test1Context.setContextPath("/test1");
+ test1Context.setHandler(new HelloHandler("Hello1"));
+ test1Context.setVirtualHosts(secureHosts);
+
+ ContextHandler test2Context = new ContextHandler();
+ test2Context.setContextPath("/test2");
+ test2Context.setHandler(new HelloHandler("Hello2"));
+ test2Context.setVirtualHosts(secureHosts);
+
+ ContextHandler rootContext = new ContextHandler();
+ rootContext.setContextPath("/");
+ rootContext.setHandler(new RootHandler("/test1","/test2"));
+ rootContext.setVirtualHosts(secureHosts);
+
+ // Wire up context for unsecure handling to only
+ // the named 'unsecured' connector
+ ContextHandler redirectHandler = new ContextHandler();
+ redirectHandler.setContextPath("/");
+ redirectHandler.setHandler(new SecuredRedirectHandler());
+ redirectHandler.setVirtualHosts(new String[] { "@unsecured" });
+
+ // Establish all handlers that have a context
+ ContextHandlerCollection contextHandlers = new ContextHandlerCollection();
+ contextHandlers.setHandlers(new Handler[] { redirectHandler, rootContext, test1Context, test2Context });
+
+ // Create server level handler tree
+ HandlerList handlers = new HandlerList();
+ handlers.addHandler(contextHandlers);
+ handlers.addHandler(new DefaultHandler()); // round things out
+
+ server.setHandler(handlers);
+
+ server.start();
+
+ // calculate serverUri
+ String host = httpConnector.getHost();
+ if (host == null)
+ {
+ host = "localhost";
+ }
+ serverHttpUri = new URI(String.format("http://%s:%d/",host,httpConnector.getLocalPort()));
+ serverHttpsUri = new URI(String.format("https://%s:%d/",host,httpsConnector.getLocalPort()));
+
+ origVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
+ origSsf = HttpsURLConnection.getDefaultSSLSocketFactory();
+
+ HttpsURLConnection.setDefaultHostnameVerifier(new AllowAllVerifier());
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslContextFactory.getSslContext().getSocketFactory());
+ }
+
+ @AfterClass
+ public static void stopServer() throws Exception
+ {
+ HttpsURLConnection.setDefaultSSLSocketFactory(origSsf);
+ HttpsURLConnection.setDefaultHostnameVerifier(origVerifier);
+
+ server.stop();
+ server.join();
+ }
+
+ @Test
+ public void testRedirectUnsecuredRoot() throws Exception
+ {
+ URL url = serverHttpUri.resolve("/").toURL();
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ connection.setInstanceFollowRedirects(false);
+ connection.setAllowUserInteraction(false);
+ assertThat("response code",connection.getResponseCode(),is(302));
+ assertThat("location header",connection.getHeaderField("Location"),is(serverHttpsUri.resolve("/").toASCIIString()));
+ connection.disconnect();
+ }
+
+ @Test
+ public void testRedirectSecuredRoot() throws Exception
+ {
+ URL url = serverHttpsUri.resolve("/").toURL();
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ connection.setInstanceFollowRedirects(false);
+ connection.setAllowUserInteraction(false);
+ assertThat("response code",connection.getResponseCode(),is(200));
+ String content = getContent(connection);
+ assertThat("response content",content,containsString(""));
+ connection.disconnect();
+ }
+
+ @Test
+ public void testAccessUnsecuredHandler() throws Exception
+ {
+ URL url = serverHttpUri.resolve("/test1").toURL();
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ connection.setInstanceFollowRedirects(false);
+ connection.setAllowUserInteraction(false);
+ assertThat("response code",connection.getResponseCode(),is(302));
+ assertThat("location header",connection.getHeaderField("Location"),is(serverHttpsUri.resolve("/test1").toASCIIString()));
+ connection.disconnect();
+ }
+
+ @Test
+ public void testAccessUnsecured404() throws Exception
+ {
+ URL url = serverHttpUri.resolve("/nothing/here").toURL();
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ connection.setInstanceFollowRedirects(false);
+ connection.setAllowUserInteraction(false);
+ assertThat("response code",connection.getResponseCode(),is(302));
+ assertThat("location header",connection.getHeaderField("Location"),is(serverHttpsUri.resolve("/nothing/here").toASCIIString()));
+ connection.disconnect();
+ }
+
+ @Test
+ public void testAccessSecured404() throws Exception
+ {
+ URL url = serverHttpsUri.resolve("/nothing/here").toURL();
+ HttpURLConnection connection = (HttpURLConnection)url.openConnection();
+ connection.setInstanceFollowRedirects(false);
+ connection.setAllowUserInteraction(false);
+ assertThat("response code",connection.getResponseCode(),is(404));
+ connection.disconnect();
+ }
+
+ private String getContent(HttpURLConnection connection) throws IOException
+ {
+ try (InputStream in = connection.getInputStream(); InputStreamReader reader = new InputStreamReader(in))
+ {
+ StringWriter writer = new StringWriter();
+ IO.copy(reader,writer);
+ return writer.toString();
+ }
+ }
+
+ public static class HelloHandler extends AbstractHandler
+ {
+ private final String msg;
+
+ public HelloHandler(String msg)
+ {
+ this.msg = msg;
+ }
+
+ @Override
+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+ {
+ response.setContentType("text/plain");
+ response.getWriter().printf("%s%n",msg);
+ baseRequest.setHandled(true);
+ }
+ }
+
+ public static class RootHandler extends AbstractHandler
+ {
+ private final String[] childContexts;
+
+ public RootHandler(String... children)
+ {
+ this.childContexts = children;
+ }
+
+ @Override
+ public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
+ {
+ if (!"/".equals(target))
+ {
+ response.sendError(404);
+ return;
+ }
+
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("");
+ out.println("
* Note: this will add the Upgrade filter to the existing list, with no regard for order. It will just be tacked onto the end of the list.
*/
- public static ServerContainer configureContext(ServletContextHandler context)
+ public static ServerContainer configureContext(ServletContextHandler context) throws ServletException
{
// Create Filter
WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configureContext(context);
@@ -70,7 +70,7 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
*
* This will use Servlet 3.1 techniques on the {@link ServletContext} to add a filter at the start of the filter chain.
*/
- public static ServerContainer configureContext(ServletContext context, ServletContextHandler jettyContext)
+ public static ServerContainer configureContext(ServletContext context, ServletContextHandler jettyContext) throws ServletException
{
// Create Filter
WebSocketUpgradeFilter filter = WebSocketUpgradeFilter.configureContext(context);
@@ -84,49 +84,71 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
return jettyContainer;
}
-
- @Override
- public void onStartup(SetChild Contexts
");
+ out.println("");
+ for (String child : childContexts)
+ {
+ out.printf("
");
+ out.println("");
+ baseRequest.setHandled(true);
+ }
+ }
+}
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java
index 0d39ab52a90..1942270e62b 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslUploadTest.java
@@ -21,6 +21,7 @@ package org.eclipse.jetty.server.ssl;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -40,6 +41,7 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.AbstractHandler;
+import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.AfterClass;
@@ -58,12 +60,13 @@ public class SslUploadTest
@BeforeClass
public static void startServer() throws Exception
{
- String keystorePath = System.getProperty("basedir",".") + "/src/test/resources/keystore";
+ File keystore = MavenTestingUtils.getTestResourceFile("keystore");
+
SslContextFactory sslContextFactory = new SslContextFactory();
- sslContextFactory.setKeyStorePath(keystorePath);
+ sslContextFactory.setKeyStorePath(keystore.getAbsolutePath());
sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setKeyManagerPassword("keypwd");
- sslContextFactory.setTrustStorePath(keystorePath);
+ sslContextFactory.setTrustStorePath(keystore.getAbsolutePath());
sslContextFactory.setTrustStorePassword("storepwd");
server = new Server();
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java
index 5f8d62a65ac..56da1041b75 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/ScheduledExecutorScheduler.java
@@ -18,6 +18,7 @@
package org.eclipse.jetty.util.thread;
+import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
@@ -38,16 +39,23 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
private final String name;
private final boolean daemon;
private volatile ScheduledThreadPoolExecutor scheduler;
+ private ClassLoader classloader;
public ScheduledExecutorScheduler()
{
this(null, false);
- }
+ }
public ScheduledExecutorScheduler(String name, boolean daemon)
+ {
+ this (name,daemon, Thread.currentThread().getContextClassLoader());
+ }
+
+ public ScheduledExecutorScheduler(String name, boolean daemon, ClassLoader threadFactoryClassLoader)
{
this.name = name == null ? "Scheduler-" + hashCode() : name;
this.daemon = daemon;
+ this.classloader = threadFactoryClassLoader;
}
@Override
@@ -60,6 +68,7 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
{
Thread thread = new Thread(r, name);
thread.setDaemon(daemon);
+ thread.setContextClassLoader(classloader);
return thread;
}
});
@@ -67,6 +76,8 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
super.doStart();
}
+
+
@Override
protected void doStop() throws Exception
{
@@ -81,6 +92,7 @@ public class ScheduledExecutorScheduler extends AbstractLifeCycle implements Sch
ScheduledFuture> result = scheduler.schedule(task, delay, unit);
return new ScheduledFutureTask(result);
}
+
private class ScheduledFutureTask implements Task
{
diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java
index 7edaaaf2c45..f3bdee9072a 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/deploy/WebSocketServerContainerInitializer.java
@@ -50,7 +50,7 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
*