本文整理汇总了Java中io.undertow.server.session.Session.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Session.getAttribute方法的具体用法?Java Session.getAttribute怎么用?Java Session.getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.undertow.server.session.Session
的用法示例。
在下文中一共展示了Session.getAttribute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sessionDestroyed
import io.undertow.server.session.Session; //导入方法依赖的package包/类
@Override
public void sessionDestroyed(Session session, HttpServerExchange exchange, SessionDestroyedReason reason) {
String ssoId = (String) session.getAttribute(SSO_SESSION_ATTRIBUTE);
if (ssoId != null) {
try (SingleSignOn sso = manager.findSingleSignOn(ssoId)) {
if (sso != null) {
sso.remove(session);
if (reason == SessionDestroyedReason.INVALIDATED) {
for (Session associatedSession : sso) {
associatedSession.invalidate(null);
sso.remove(associatedSession);
}
}
// If there are no more associated sessions, remove the SSO altogether
if (!sso.iterator().hasNext()) {
manager.removeSingleSignOn(ssoId);
}
}
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:SingleSignOnAuthenticationMechanism.java示例2: handleRedirectBack
import io.undertow.server.session.Session; //导入方法依赖的package包/类
@Override
protected void handleRedirectBack(final HttpServerExchange exchange) {
final ServletRequestContext servletRequestContext = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
HttpServletResponse resp = (HttpServletResponse) servletRequestContext.getServletResponse();
HttpSessionImpl httpSession = servletRequestContext.getCurrentServletContext().getSession(exchange, false);
if (httpSession != null) {
Session session;
if (System.getSecurityManager() == null) {
session = httpSession.getSession();
} else {
session = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(httpSession));
}
String path = (String) session.getAttribute(SESSION_KEY);
if (path != null) {
try {
resp.sendRedirect(path);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:ServletFormAuthenticationMechanism.java示例3: lookupSession
import io.undertow.server.session.Session; //导入方法依赖的package包/类
@Override
public AuthenticatedSession lookupSession(HttpServerExchange exchange) {
HttpSessionImpl httpSession = servletContext.getSession(exchange, false);
if (httpSession != null) {
Session session;
if (System.getSecurityManager() == null) {
session = httpSession.getSession();
} else {
session = AccessController.doPrivileged(new HttpSessionImpl.UnwrapSessionAction(httpSession));
}
return (AuthenticatedSession) session.getAttribute(ATTRIBUTE_NAME);
}
return null;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:CachedAuthenticatedSessionHandler.java示例4: stop
import io.undertow.server.session.Session; //导入方法依赖的package包/类
public void stop() {
ClassLoader old = getTccl();
try {
setTccl(servletContext.getClassLoader());
this.started = false;
final Map<String, SessionPersistenceManager.PersistentSession> objectData = new HashMap<>();
for (String sessionId : sessionManager.getTransientSessions()) {
Session session = sessionManager.getSession(sessionId);
if (session != null) {
final HttpSessionEvent event = new HttpSessionEvent(SecurityActions.forSession(session, servletContext, false));
final Map<String, Object> sessionData = new HashMap<>();
for (String attr : session.getAttributeNames()) {
final Object attribute = session.getAttribute(attr);
sessionData.put(attr, attribute);
if (attribute instanceof HttpSessionActivationListener) {
((HttpSessionActivationListener) attribute).sessionWillPassivate(event);
}
}
objectData.put(sessionId, new PersistentSession(new Date(session.getLastAccessedTime() + (session.getMaxInactiveInterval() * 1000)), sessionData));
}
}
sessionPersistenceManager.persistSessions(deploymentName, objectData);
this.data.clear();
} finally {
setTccl(old);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:SessionRestoringHandler.java示例5: handleRequest
import io.undertow.server.session.Session; //导入方法依赖的package包/类
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
Session session = Sessions.getOrCreateSession(exchange);
session.setAttribute("object", new Bean());
Bean object = (Bean) session.getAttribute("object");
System.out.println(object);
exchange.getResponseSender().send(object.getName());
}
开发者ID:coat,项目名称:undertow-redis-session,代码行数:11,代码来源:RedisSessionManagerIT.java本文标签属性:
示例:示例是什么意思
代码:代码零九
java:javascript18岁
Session:session和cookie的区别
getAttribute:getattribute和getparameter