HADOOP-11677. Add cookie flags for logs and static contexts. Contributed by nijel.

This commit is contained in:
Haohui Mai 2015-11-22 19:52:13 -08:00
parent 053a511919
commit 611aa77f75
2 changed files with 20 additions and 0 deletions

View File

@ -1460,6 +1460,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-10068. Improve log4j regex in testFindContainingJar.
(Robert Rati via wheat9)
HADOOP-11677. Add cookie flags for logs and static contexts.
(nijel via wheat9)
Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -86,6 +86,7 @@
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.FilterHolder;
import org.mortbay.jetty.servlet.SessionHandler;
import org.mortbay.jetty.servlet.FilterMapping;
import org.mortbay.jetty.servlet.ServletHandler;
import org.mortbay.jetty.servlet.ServletHolder;
@ -521,6 +522,14 @@ protected void addDefaultApps(ContextHandlerCollection parent,
"org.mortbay.jetty.servlet.Default.aliases", "true");
}
logContext.setDisplayName("logs");
SessionHandler handler = new SessionHandler();
SessionManager sm = handler.getSessionManager();
if (sm instanceof AbstractSessionManager) {
AbstractSessionManager asm = (AbstractSessionManager) sm;
asm.setHttpOnly(true);
asm.setSecureCookies(true);
}
logContext.setSessionHandler(handler);
setContextAttributes(logContext, conf);
addNoCacheFilter(webAppContext);
defaultContexts.put(logContext, true);
@ -530,6 +539,14 @@ protected void addDefaultApps(ContextHandlerCollection parent,
staticContext.setResourceBase(appDir + "/static");
staticContext.addServlet(DefaultServlet.class, "/*");
staticContext.setDisplayName("static");
SessionHandler handler = new SessionHandler();
SessionManager sm = handler.getSessionManager();
if (sm instanceof AbstractSessionManager) {
AbstractSessionManager asm = (AbstractSessionManager) sm;
asm.setHttpOnly(true);
asm.setSecureCookies(true);
}
staticContext.setSessionHandler(handler);
setContextAttributes(staticContext, conf);
defaultContexts.put(staticContext, true);
}