|
@@ -80,12 +80,10 @@ import org.eclipse.jetty.server.RequestLog;
|
|
|
import org.eclipse.jetty.server.SecureRequestCustomizer;
|
|
|
import org.eclipse.jetty.server.Server;
|
|
|
import org.eclipse.jetty.server.ServerConnector;
|
|
|
-import org.eclipse.jetty.server.SessionManager;
|
|
|
import org.eclipse.jetty.server.SslConnectionFactory;
|
|
|
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
|
|
|
import org.eclipse.jetty.server.handler.HandlerCollection;
|
|
|
import org.eclipse.jetty.server.handler.RequestLogHandler;
|
|
|
-import org.eclipse.jetty.server.session.AbstractSessionManager;
|
|
|
import org.eclipse.jetty.server.session.SessionHandler;
|
|
|
import org.eclipse.jetty.servlet.DefaultServlet;
|
|
|
import org.eclipse.jetty.servlet.FilterHolder;
|
|
@@ -498,7 +496,8 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
httpConfig.addCustomizer(new SecureRequestCustomizer());
|
|
|
ServerConnector conn = createHttpChannelConnector(server, httpConfig);
|
|
|
|
|
|
- SslContextFactory sslContextFactory = new SslContextFactory();
|
|
|
+ SslContextFactory.Server sslContextFactory =
|
|
|
+ new SslContextFactory.Server();
|
|
|
sslContextFactory.setNeedClientAuth(needsClientAuth);
|
|
|
sslContextFactory.setKeyManagerPassword(keyPassword);
|
|
|
if (keyStore != null) {
|
|
@@ -566,12 +565,9 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
threadPool.setMaxThreads(maxThreads);
|
|
|
}
|
|
|
|
|
|
- SessionManager sm = webAppContext.getSessionHandler().getSessionManager();
|
|
|
- if (sm instanceof AbstractSessionManager) {
|
|
|
- AbstractSessionManager asm = (AbstractSessionManager)sm;
|
|
|
- asm.setHttpOnly(true);
|
|
|
- asm.getSessionCookieConfig().setSecure(true);
|
|
|
- }
|
|
|
+ SessionHandler handler = webAppContext.getSessionHandler();
|
|
|
+ handler.setHttpOnly(true);
|
|
|
+ handler.getSessionCookieConfig().setSecure(true);
|
|
|
|
|
|
ContextHandlerCollection contexts = new ContextHandlerCollection();
|
|
|
RequestLog requestLog = HttpRequestLog.getRequestLog(name);
|
|
@@ -713,12 +709,8 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
}
|
|
|
logContext.setDisplayName("logs");
|
|
|
SessionHandler handler = new SessionHandler();
|
|
|
- SessionManager sm = handler.getSessionManager();
|
|
|
- if (sm instanceof AbstractSessionManager) {
|
|
|
- AbstractSessionManager asm = (AbstractSessionManager) sm;
|
|
|
- asm.setHttpOnly(true);
|
|
|
- asm.getSessionCookieConfig().setSecure(true);
|
|
|
- }
|
|
|
+ handler.setHttpOnly(true);
|
|
|
+ handler.getSessionCookieConfig().setSecure(true);
|
|
|
logContext.setSessionHandler(handler);
|
|
|
setContextAttributes(logContext, conf);
|
|
|
addNoCacheFilter(logContext);
|
|
@@ -735,12 +727,8 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
params.put("org.eclipse.jetty.servlet.Default.dirAllowed", "false");
|
|
|
params.put("org.eclipse.jetty.servlet.Default.gzip", "true");
|
|
|
SessionHandler handler = new SessionHandler();
|
|
|
- SessionManager sm = handler.getSessionManager();
|
|
|
- if (sm instanceof AbstractSessionManager) {
|
|
|
- AbstractSessionManager asm = (AbstractSessionManager) sm;
|
|
|
- asm.setHttpOnly(true);
|
|
|
- asm.getSessionCookieConfig().setSecure(true);
|
|
|
- }
|
|
|
+ handler.setHttpOnly(true);
|
|
|
+ handler.getSessionCookieConfig().setSecure(true);
|
|
|
staticContext.setSessionHandler(handler);
|
|
|
setContextAttributes(staticContext, conf);
|
|
|
defaultContexts.put(staticContext, true);
|
|
@@ -1208,7 +1196,7 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
* @return
|
|
|
*/
|
|
|
private static BindException constructBindException(ServerConnector listener,
|
|
|
- BindException ex) {
|
|
|
+ IOException ex) {
|
|
|
BindException be = new BindException("Port in use: "
|
|
|
+ listener.getHost() + ":" + listener.getPort());
|
|
|
if (ex != null) {
|
|
@@ -1230,7 +1218,7 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
try {
|
|
|
bindListener(listener);
|
|
|
break;
|
|
|
- } catch (BindException ex) {
|
|
|
+ } catch (IOException ex) {
|
|
|
if (port == 0 || !findPort) {
|
|
|
throw constructBindException(listener, ex);
|
|
|
}
|
|
@@ -1250,13 +1238,13 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
*/
|
|
|
private void bindForPortRange(ServerConnector listener, int startPort)
|
|
|
throws Exception {
|
|
|
- BindException bindException = null;
|
|
|
+ IOException ioException = null;
|
|
|
try {
|
|
|
bindListener(listener);
|
|
|
return;
|
|
|
- } catch (BindException ex) {
|
|
|
+ } catch (IOException ex) {
|
|
|
// Ignore exception.
|
|
|
- bindException = ex;
|
|
|
+ ioException = ex;
|
|
|
}
|
|
|
for(Integer port : portRanges) {
|
|
|
if (port == startPort) {
|
|
@@ -1269,10 +1257,10 @@ public final class HttpServer2 implements FilterContainer {
|
|
|
return;
|
|
|
} catch (BindException ex) {
|
|
|
// Ignore exception. Move to next port.
|
|
|
- bindException = ex;
|
|
|
+ ioException = ex;
|
|
|
}
|
|
|
}
|
|
|
- throw constructBindException(listener, bindException);
|
|
|
+ throw constructBindException(listener, ioException);
|
|
|
}
|
|
|
|
|
|
/**
|