|
@@ -88,13 +88,11 @@ 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.AllowSymLinkAliasChecker;
|
|
|
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.FilterHolder;
|
|
|
import org.eclipse.jetty.servlet.FilterMapping;
|
|
@@ -519,7 +517,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) {
|
|
@@ -621,12 +620,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);
|
|
@@ -777,12 +773,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);
|
|
|
logContext.addAliasCheck(new AllowSymLinkAliasChecker());
|
|
|
setContextAttributes(logContext, conf);
|
|
@@ -800,12 +792,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);
|
|
|
staticContext.addAliasCheck(new AllowSymLinkAliasChecker());
|
|
|
setContextAttributes(staticContext, conf);
|
|
@@ -1268,7 +1256,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) {
|
|
@@ -1290,7 +1278,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);
|
|
|
}
|
|
@@ -1310,13 +1298,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) {
|
|
@@ -1329,10 +1317,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);
|
|
|
}
|
|
|
|
|
|
/**
|