本文整理了Java中org.eclipse.jetty.server.SessionManager
类的一些代码示例,展示了SessionManager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SessionManager
类的具体详情如下:
包路径:org.eclipse.jetty.server.SessionManager
类名称:SessionManager
暂无
代码示例来源:origin: apache/drill
final SecurityHandler securityHandler) {
SessionManager sessionManager = new HashSessionManager();
sessionManager.setMaxInactiveInterval(
config.getInt(DrillOnYarnConfig.HTTP_SESSION_MAX_IDLE_SECS));
sessionManager.addEventListener(new HttpSessionListener() {
@Override
public void sessionCreated(HttpSessionEvent se) {
return new SessionHandler(sessionManager);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
public String encodeURL(String url)
SessionManager sessionManager = request.getSessionManager();
if (sessionManager==null)
return url;
if (sessionManager.isCheckingRemoteSessionIdEncoding() && URIUtil.hasScheme(url))
if (port<0)
port = HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme())?443:80;
if (!request.getServerName().equalsIgnoreCase(uri.getHost()) ||
request.getServerPort()!=port ||
!path.startsWith(request.getContextPath())) //TODO the root context path is "", with which every non null string starts
return url;
String sessionURLPrefix = sessionManager.getSessionIdPathParameterNamePrefix();
if (sessionURLPrefix==null)
return url;
if ((sessionManager.isUsingCookies() && request.isRequestedSessionIdFromCookie()) || !sessionManager.isUsingURLs())
if (!sessionManager.isValid(session))
return url;
String id=sessionManager.getNodeId(session);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
SessionManager sessionManager = getSessionManager();
HttpSession session = sessionManager.getHttpSession(requested_session_id);
if (session != null && sessionManager.isValid(session))
baseRequest.setSession(session);
return;
if (_sessionManager.isUsingCookies())
final String sessionCookie=sessionManager.getSessionCookieConfig().getName();
for (int i = 0; i < cookies.length; i++)
session = sessionManager.getHttpSession(requested_session_id);
if (session != null && sessionManager.isValid(session))
String prefix = sessionManager.getSessionIdPathParameterNamePrefix();
if (prefix != null)
session = sessionManager.getHttpSession(requested_session_id);
if (LOG.isDebugEnabled())
LOG.debug("Got Session ID {} from URL",requested_session_id);
baseRequest.setRequestedSessionId(requested_session_id);
baseRequest.setRequestedSessionIdFromCookie(requested_session_id != null && requested_session_id_from_cookie);
if (session != null && sessionManager.isValid(session))
baseRequest.setSession(session);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server
public HttpSession getSession(boolean create)
{
if (_session != null)
{
if (_sessionManager != null && !_sessionManager.isValid(_session))
_session = null;
else
return _session;
}
if (!create)
return null;
if (_sessionManager == null)
throw new IllegalStateException("No SessionManager");
_session = _sessionManager.newHttpSession(this);
HttpCookie cookie = _sessionManager.getSessionCookie(_session,getContextPath(),isSecure());
if (cookie != null)
_connection.getResponse().addCookie(cookie);
return _session;
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
public String changeSessionId()
{
HttpSession session = getSession(false);
if (session == null)
throw new IllegalStateException("No session");
if (session instanceof AbstractSession)
{
AbstractSession abstractSession = ((AbstractSession)session);
abstractSession.renewId(this);
if (getRemoteUser() != null)
abstractSession.setAttribute(AbstractSession.SESSION_KNOWN_ONLY_TO_AUTHENTICATED, Boolean.TRUE);
if (abstractSession.isIdChanged())
_channel.getResponse().addCookie(_sessionManager.getSessionCookie(abstractSession, getContextPath(), isSecure()));
}
return session.getId();
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
context.getSessionHandler().getSessionManager().setMaxInactiveInterval(timeout * 60);
modes.addAll(context.getSessionHandler().getSessionManager().getEffectiveSessionTrackingModes());
while (iter.hasNext())
context.getSessionHandler().getSessionManager().setSessionTrackingModes(modes);
context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(name);
context.getMetaData().setOrigin("cookie-config.name", descriptor);
break;
context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(name);
context.getMetaData().setOrigin("cookie-config.name", descriptor);
if (!context.getSessionHandler().getSessionManager().getSessionCookieConfig().getName().equals(name))
throw new IllegalStateException("Conflicting cookie-config name "+name+" in "+descriptor.getResource());
break;
context.getSessionHandler().getSessionManager().getSessionCookieConfig().setDomain(domain);
context.getMetaData().setOrigin("cookie-config.domain", descriptor);
break;
context.getSessionHandler().getSessionManager().getSessionCookieConfig().setDomain(domain);
context.getMetaData().setOrigin("cookie-config.domain", descriptor);
if (!context.getSessionHandler().getSessionManager().getSessionCookieConfig().getDomain().equals(domain))
throw new IllegalStateException("Conflicting cookie-config domain "+domain+" in "+descriptor.getResource());
break;
代码示例来源:origin: theonedev/onedev
String connection = _channel.getRequest().getHeader(HttpHeader.CONNECTION.asString());
if (connection != null)
if (HttpVersion.HTTP_1_0.is(_channel.getRequest().getProtocol()))
_fields.put(HttpHeader.CONNECTION, HttpHeaderValue.KEEP_ALIVE.toString());
break;
HttpSession session = request.getSession(false);
if (session!=null && session.isNew())
if (sm!=null)
HttpCookie c=sm.getSessionCookie(session,request.getContextPath(),request.isSecure());
if (c!=null)
addCookie(c);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
@Override
public SessionCookieConfig getSessionCookieConfig()
{
// TODO other started conditions
if (!_enabled)
throw new UnsupportedOperationException();
if (_sessionHandler!=null)
return _sessionHandler.getSessionManager().getSessionCookieConfig();
return null;
}
代码示例来源:origin: org.apache.accumulo/accumulo-monitor
connector.setPort(port);
handler = new ServletContextHandler(server, "/", new SessionHandler(),
new ConstraintSecurityHandler(), null, null);
handler.getSessionHandler().getSessionManager().getSessionCookieConfig().setHttpOnly(true);
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
sessionManager.setMaxInactiveInterval(config.getInt(ExecConstants.HTTP_SESSION_MAX_IDLE_SECS));
sessionManager.getSessionCookieConfig().setHttpOnly(true);
sessionManager.addEventListener(new HttpSessionListener() {
@Override
public void sessionCreated(HttpSessionEvent se) {
return new SessionHandler(sessionManager);
代码示例来源:origin: org.keycloak/keycloak-saml-jetty93-adapter
@Override
public HttpSession getHttpSession(String id) {
return sessionManager.getHttpSession(id);
}
}
代码示例来源:origin: zenvisage/zenvisage
public void start() throws Exception {
server = new Server(port);
WebAppContext webAppContext = new WebAppContext();
webAppContext.setContextPath("/");
webAppContext.setWar("zenvisage.war");
webAppContext.setParentLoaderPriority(true);
webAppContext.setServer(server);
webAppContext.setClassLoader(ClassLoader.getSystemClassLoader());
webAppContext.getSessionHandler().getSessionManager()
.setMaxInactiveInterval(10);
server.setHandler(webAppContext);
server.start();
// ZvMain zvMain = (ZvMain) SpringApplicationContext.getBean("zvMain");
// zvMain.loadData();
DatabaseAutoLoader databaseAutoLoader = new DatabaseAutoLoader(this);
databaseAutoLoader.run();
}
代码示例来源:origin: theonedev/onedev
context.setContextPath("/");
context.getSessionHandler().getSessionManager().setMaxInactiveInterval(serverConfig.getSessionTimeout());
context.addServlet(imgServletHolder, "/img/*");
context.getSessionHandler().addEventListener(new HttpSessionListener() {
代码示例来源:origin: org.gatein.wci/wci-jetty8
@Override
public HttpSession getHttpSession(String sessId)
{
return contextHandler.getSessionHandler().getSessionManager().getHttpSession(sessId);
}
代码示例来源:origin: org.visallo/visallo-jetty-server
webAppContext.getSessionHandler().getSessionManager().setMaxInactiveInterval(getSessionTimeout() * 60);
webAppContext.getSessionHandler().getSessionManager().getMaxInactiveInterval()
);
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
/**
* @param listener
*/
public void addEventListener(EventListener listener)
{
if (_sessionManager != null)
_sessionManager.addEventListener(listener);
}
代码示例来源:origin: stackoverflow.com
SessionManager sessionManager = new HashSessionManager();
sessionManager.setMaxInactiveInterval(60 * 15); //session time out of 15 minutes
HashSessionIdManager idManager = new HashSessionIdManager();
sessionManager.getSessionCookieConfig().setName("JSESSIONID_" + Integer.toString(m_serverSettings.getM_webServerPort()));
sessionManager.setSessionIdManager(idManager);
SessionHandler sessionHandler = new SessionHandler(sessionManager);
代码示例来源:origin: stackoverflow.com
// To be passed to all scanned webapps. Ensures SSO between contexts
SessionManager sessManager = new HashSessionManager();
SessionCookieConfig config = sessManager.getSessionCookieConfig();
config.setPath("/webapps/"); // Ensures all webapps share the same cookie
// Create the Handler (a.k.a the WebAppContext).
App app = new App(deployer, provider, module.getFile().getAbsolutePath());
WebAppContext handler = (WebAppContext)app.getContextHandler(); // getContextHandler does the extraction
// Consolidating all scanned webapps under a single context path allows SSO
handler.setContextPath("/webapps" + handler.getContextPath());
// Cookies need to be shared between webapps for SSO
SessionHandler sessHandler = handler.getSessionHandler();
sessHandler.setSessionManager(sessManager);
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
abstractSession.setAttribute(AbstractSession.SESSION_KNOWN_ONLY_TO_AUTHENTICATED, Boolean.TRUE);
if (abstractSession.isIdChanged() && response != null && (response instanceof Response))
((Response)response).addCookie(abstractSession.getSessionManager().getSessionCookie(abstractSession, request.getContextPath(), request.isSecure()));
LOG.debug("renew {}->{}",oldId,abstractSession.getId());
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus
public String encodeURL(String url)
SessionManager sessionManager = request.getSessionManager();
if (sessionManager==null)
return url;
if (sessionManager.isCheckingRemoteSessionIdEncoding() && URIUtil.hasScheme(url))
if (port<0)
port = HttpSchemes.HTTPS.equalsIgnoreCase(uri.getScheme())?443:80;
if (!request.getServerName().equalsIgnoreCase(uri.getHost()) ||
request.getServerPort()!=port ||
!path.startsWith(request.getContextPath())) //TODO the root context path is "", with which every non null string starts
return url;
String sessionURLPrefix = sessionManager.getSessionIdPathParameterNamePrefix();
if (sessionURLPrefix==null)
return url;
if ((sessionManager.isUsingCookies() && request.isRequestedSessionIdFromCookie()) || !sessionManager.isUsingURLs())
if (!sessionManager.isValid(session))
return url;
String id=sessionManager.getNodeId(session);
内容来源于网络,如有侵权,请联系作者删除!