本文整理汇总了Java中io.undertow.server.session.SessionManager类的典型用法代码示例。如果您正苦于以下问题:Java SessionManager类的具体用法?Java SessionManager怎么用?Java SessionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SessionManager类属于io.undertow.server.session包,在下文中一共展示了SessionManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSession
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
public HttpSessionImpl getSession(final ServletContextImpl originalServletContext, final HttpServerExchange exchange, boolean create) {
SessionConfig c = originalServletContext.getSessionConfig();
HttpSessionImpl httpSession = exchange.getAttachment(sessionAttachmentKey);
if (httpSession != null && httpSession.isInvalid()) {
exchange.removeAttachment(sessionAttachmentKey);
httpSession = null;
}
if (httpSession == null) {
final SessionManager sessionManager = deployment.getSessionManager();
Session session = sessionManager.getSession(exchange, c);
if (session != null) {
httpSession = SecurityActions.forSession(session, this, false);
exchange.putAttachment(sessionAttachmentKey, httpSession);
} else if (create) {
String existing = c.findSessionId(exchange);
if (originalServletContext != this) {
//this is a cross context request
//we need to make sure there is a top level session
originalServletContext.getSession(originalServletContext, exchange, true);
} else if (existing != null) {
c.clearSession(exchange, existing);
}
final Session newSession = sessionManager.createSession(exchange, c);
httpSession = SecurityActions.forSession(newSession, this, true);
exchange.putAttachment(sessionAttachmentKey, httpSession);
}
}
return httpSession;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:ServletContextImpl.java
示例2: registerSessionIfRequired
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
private void registerSessionIfRequired(SingleSignOn sso, Session session) {
if (!sso.contains(session)) {
sso.add(session);
session.setAttribute(SSO_SESSION_ATTRIBUTE, sso.getId());
SessionManager manager = session.getSessionManager();
if (seenSessionManagers.add(manager)) {
manager.registerSessionListener(listener);
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:SingleSignOnAuthenticationMechanism.java
示例3: SessionRestoringHandler
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
public SessionRestoringHandler(String deploymentName, SessionManager sessionManager, ServletContextImpl servletContext, HttpHandler next, SessionPersistenceManager sessionPersistenceManager) {
this.deploymentName = deploymentName;
this.sessionManager = sessionManager;
this.servletContext = servletContext;
this.next = next;
this.sessionPersistenceManager = sessionPersistenceManager;
this.data = new ConcurrentHashMap<>();
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:SessionRestoringHandler.java
示例4: handleDevelopmentModePersistentSessions
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
private HttpHandler handleDevelopmentModePersistentSessions(HttpHandler next, final DeploymentInfo deploymentInfo, final SessionManager sessionManager, final ServletContextImpl servletContext) {
final SessionPersistenceManager sessionPersistenceManager = deploymentInfo.getSessionPersistenceManager();
if (sessionPersistenceManager != null) {
SessionRestoringHandler handler = new SessionRestoringHandler(deployment.getDeploymentInfo().getDeploymentName(), sessionManager, servletContext, next, sessionPersistenceManager);
deployment.addLifecycleObjects(handler);
return handler;
}
return next;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:DeploymentManagerImpl.java
示例5: getSession
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public Object getSession() {
SessionManager sm = exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
SessionConfig sessionCookieConfig = exchange.getAttachment(SessionConfig.ATTACHMENT_KEY);
if(sm != null && sessionCookieConfig != null) {
return sm.getSession(exchange, sessionCookieConfig);
}
return null;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AsyncWebSocketHttpServerExchange.java
示例6: getSession
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
/**
* Gets the active session, returning null if one is not present.
* @param exchange The exchange
* @return The session
*/
public static Session getSession(final HttpServerExchange exchange) {
SessionManager sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
SessionConfig sessionConfig = exchange.getAttachment(SessionConfig.ATTACHMENT_KEY);
if(sessionManager == null) {
throw UndertowMessages.MESSAGES.sessionManagerNotFound();
}
return sessionManager.getSession(exchange, sessionConfig);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:Sessions.java
示例7: getOrCreateSession
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
/**
* Gets the active session, creating a new one if one does not exist
* @param exchange The exchange
* @return The session
*/
public static Session getOrCreateSession(final HttpServerExchange exchange) {
SessionManager sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
SessionConfig sessionConfig = exchange.getAttachment(SessionConfig.ATTACHMENT_KEY);
if(sessionManager == null) {
throw UndertowMessages.MESSAGES.sessionManagerNotFound();
}
Session session = sessionManager.getSession(exchange, sessionConfig);
if(session == null) {
session = sessionManager.createSession(exchange, sessionConfig);
}
return session;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:Sessions.java
示例8: createDeploymentManager
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
private DeploymentManager createDeploymentManager(
ServletContextInitializer... initializers) {
DeploymentInfo deployment = Servlets.deployment();
registerServletContainerInitializerToDriveServletContextInitializers(deployment,
initializers);
deployment.setClassLoader(getServletClassLoader());
deployment.setContextPath(getContextPath());
deployment.setDisplayName(getDisplayName());
deployment.setDeploymentName("spring-boot");
if (isRegisterDefaultServlet()) {
deployment.addServlet(Servlets.servlet("default", DefaultServlet.class));
}
configureErrorPages(deployment);
deployment.setServletStackTraces(ServletStackTraces.NONE);
deployment.setResourceManager(getDocumentRootResourceManager());
configureMimeMappings(deployment);
for (UndertowDeploymentInfoCustomizer customizer : this.deploymentInfoCustomizers) {
customizer.customize(deployment);
}
if (isAccessLogEnabled()) {
configureAccessLog(deployment);
}
if (isPersistSession()) {
File dir = getValidSessionStoreDir();
deployment.setSessionPersistenceManager(new FileSessionPersistence(dir));
}
DeploymentManager manager = Servlets.newContainer().addDeployment(deployment);
manager.deploy();
SessionManager sessionManager = manager.getDeployment().getSessionManager();
int sessionTimeout = (getSessionTimeout() > 0 ? getSessionTimeout() : -1);
sessionManager.setDefaultSessionTimeout(sessionTimeout);
return manager;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:34,代码来源:UndertowEmbeddedServletContainerFactory.java
示例9: createDeploymentManager
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
private DeploymentManager createDeploymentManager(
ServletContextInitializer... initializers) {
DeploymentInfo deployment = Servlets.deployment();
registerServletContainerInitializerToDriveServletContextInitializers(deployment,
initializers);
deployment.setClassLoader(getServletClassLoader());
deployment.setContextPath(getContextPath());
deployment.setDisplayName(getDisplayName());
deployment.setDeploymentName("spring-boot");
if (isRegisterDefaultServlet()) {
deployment.addServlet(Servlets.servlet("default", DefaultServlet.class));
}
configureErrorPages(deployment);
deployment.setServletStackTraces(ServletStackTraces.NONE);
deployment.setResourceManager(getDocumentRootResourceManager());
configureMimeMappings(deployment);
for (UndertowDeploymentInfoCustomizer customizer : this.deploymentInfoCustomizers) {
customizer.customize(deployment);
}
if (isAccessLogEnabled()) {
configureAccessLog(deployment);
}
if (isPersistSession()) {
File folder = getValidSessionStoreDir();
deployment.setSessionPersistenceManager(new FileSessionPersistence(folder));
}
DeploymentManager manager = Servlets.defaultContainer().addDeployment(deployment);
manager.deploy();
SessionManager sessionManager = manager.getDeployment().getSessionManager();
int sessionTimeout = (getSessionTimeout() > 0 ? getSessionTimeout() : -1);
sessionManager.setDefaultSessionTimeout(sessionTimeout);
return manager;
}
开发者ID:Nephilim84,项目名称:contestparser,代码行数:34,代码来源:UndertowEmbeddedServletContainerFactory.java
示例10: getScope
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public HttpScope getScope(Scope scope) {
if (scopeResolvers.containsKey(scope)) {
return scopeResolvers.get(scope).apply(httpServerExchange);
}
switch (scope) {
case APPLICATION: {
SessionManager sessionManager = getSessionManager();
if (sessionManager == null) return null;
return new HttpScope() {
@Override
public String getID() {
// TODO Find a better mechanism for obtaining a unique deployment ID
return sessionManager.getDeploymentName();
}
};
}
case CONNECTION:
return getScope(httpServerExchange.getConnection());
case EXCHANGE:
return getScope(httpServerExchange);
case GLOBAL:
return null;
case SESSION:
return toScope(null);
case SSL_SESSION:
return getScope(getSSLSession());
}
return null;
}
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:33,代码来源:ElytronHttpExchange.java
示例11: getScopeIds
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public Collection<String> getScopeIds(Scope scope) {
if (scope == Scope.SESSION) {
SessionManager sessionManager = getSessionManager();
return sessionManager.getAllSessions();
}
return null;
}
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:10,代码来源:ElytronHttpExchange.java
示例12: handleRequest
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
if (exchange.getRequestPath().endsWith("/logout")) {
SessionManager sessionManager = getSessionManager(exchange);
if (sessionManager != null) {
Session session = sessionManager.getSession(exchange, getSessionConfig(exchange));
if (session != null) {
session.invalidate(exchange);
exchange.endExchange();
}
}
} else {
next.handleRequest(exchange);
}
}
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:16,代码来源:SessionInvalidationHandler.java
示例13: configureSessionManager
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
protected void configureSessionManager(SessionManager sessionManager , List<Class<?>> annotatedSessionListeners ){
SessionListenerMounter mounter = new SessionListenerMounterImpl();
for (Class<?> annotatedClass : annotatedSessionListeners) {
SessionListener sl = mounter.mount(annotatedClass);
if(sl != null){
sessionManager.registerSessionListener( sl);
}
}
}
开发者ID:EsmerilProgramming,项目名称:overtown,代码行数:10,代码来源:StartupHandlerImpl.java
示例14: getSession
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public Session getSession(SessionManager manager) {
return this.sessions.get(manager);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:InMemorySingleSignOnManager.java
示例15: setSessionManager
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
void setSessionManager(final SessionManager sessionManager) {
this.sessionManager = sessionManager;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:DeploymentImpl.java
示例16: getSessionManager
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public SessionManager getSessionManager() {
return sessionManager;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:DeploymentImpl.java
示例17: createSessionManager
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public SessionManager createSessionManager(Deployment deployment) {
return new InMemorySessionManager(deployment.getDeploymentInfo().getDeploymentName(), maxSessions);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:InMemorySessionManagerFactory.java
示例18: createUndertowServer
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
private UndertowServer createUndertowServer(int port) {
SessionManager sessionManager = new InfinispanSessionManager(String.valueOf(port));
return new UndertowServer(createRootHttpHandler(sessionManager), port, sessionManager.getDeploymentName());
}
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:5,代码来源:FormAuthenticationWithSessionReplicationTest.java
示例19: equals
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
@Override
public boolean equals(Object object) {
if (!(object instanceof SessionManager)) return false;
SessionManager manager = (SessionManager) object;
return this.deploymentName.equals(manager.getDeploymentName());
}
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:7,代码来源:InfinispanSessionManager.java
示例20: getSessionManager
import io.undertow.server.session.SessionManager; //导入依赖的package包/类
private SessionManager getSessionManager(HttpServerExchange exchange) {
return exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
}
开发者ID:wildfly-security,项目名称:elytron-web,代码行数:4,代码来源:SessionInvalidationHandler.java
注:本文中的io.undertow.server.session.SessionManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论