@Override
public void sessionDestroyed(HttpSessionEvent se) {
// Close all Comet connections associated with this session
Request[] reqs = (Request[])
se.getSession().getAttribute(cometRequestsAttribute);
if (reqs != null) {
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
CometEventImpl event = req.getEvent();
event.setEventType(CometEvent.EventType.END);
event.setEventSubType(CometEvent.EventSubType.SESSION_END);
((CometProcessor)
req.getWrapper().getServlet()).event(event);
event.close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger().warn(sm.getString(
"cometConnectionManagerValve.listenerEvent"), e);
}
}
}
}
java类javax.servlet.http.HttpSessionEvent的实例源码
CometConnectionManagerValve.java 文件源码
项目:tomcat7
阅读 39
收藏 0
点赞 0
评论 0
CometConnectionManagerValve.java 文件源码
项目:lazycat
阅读 40
收藏 0
点赞 0
评论 0
@Override
public void sessionDestroyed(HttpSessionEvent se) {
// Close all Comet connections associated with this session
Request[] reqs = (Request[]) se.getSession().getAttribute(cometRequestsAttribute);
if (reqs != null) {
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
CometEventImpl event = req.getEvent();
event.setEventType(CometEvent.EventType.END);
event.setEventSubType(CometEvent.EventSubType.SESSION_END);
((CometProcessor) req.getWrapper().getServlet()).event(event);
event.close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger()
.warn(sm.getString("cometConnectionManagerValve.listenerEvent"), e);
}
}
}
}
CometConnectionManagerValve.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 42
收藏 0
点赞 0
评论 0
@Override
public void sessionDestroyed(HttpSessionEvent se) {
// Close all Comet connections associated with this session
Request[] reqs = (Request[])
se.getSession().getAttribute(cometRequestsAttribute);
if (reqs != null) {
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
CometEventImpl event = req.getEvent();
event.setEventType(CometEvent.EventType.END);
event.setEventSubType(CometEvent.EventSubType.SESSION_END);
((CometProcessor)
req.getWrapper().getServlet()).event(event);
event.close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger().warn(sm.getString(
"cometConnectionManagerValve.listenerEvent"), e);
}
}
}
}
SessionEventHttpSessionListenerAdapter.java 文件源码
项目:lemon
阅读 46
收藏 0
点赞 0
评论 0
public void onApplicationEvent(AbstractSessionEvent event) {
if (this.listeners.isEmpty()) {
return;
}
HttpSessionEvent httpSessionEvent = createHttpSessionEvent(event);
for (HttpSessionListener listener : this.listeners) {
if (event instanceof SessionDestroyedEvent) {
listener.sessionDestroyed(httpSessionEvent);
}
else if (event instanceof SessionCreatedEvent) {
listener.sessionCreated(httpSessionEvent);
}
}
}
SessionListener.java 文件源码
项目:dswork
阅读 55
收藏 0
点赞 0
评论 0
public void sessionDestroyed(HttpSessionEvent event)
{
System.out.println("sessionDestroyed:::" + event.getSession().getId());
try
{
HttpSession session = event.getSession();
String ticket = String.valueOf(session.getAttribute(SessionListener.DS_SSO_TICKET));
if(!ticket.equals("null") && ticket.length() > 0)
{
((AuthFactoryService)dswork.spring.BeanFactory.getBean(AuthFactoryService.class)).saveLogLogout(ticket, true, false);
TicketService.removeSession(ticket);// 应该是超时
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
CometConnectionManagerValve.java 文件源码
项目:lams
阅读 40
收藏 0
点赞 0
评论 0
public void sessionDestroyed(HttpSessionEvent se) {
// Close all Comet connections associated with this session
Request[] reqs = (Request[])
se.getSession().getAttribute(cometRequestsAttribute);
if (reqs != null) {
for (int i = 0; i < reqs.length; i++) {
Request req = reqs[i];
try {
req.getEvent().close();
} catch (Exception e) {
req.getWrapper().getParent().getLogger().warn(sm.getString(
"cometConnectionManagerValve.listenerEvent"), e);
}
}
}
}
SessionListener.java 文件源码
项目:lams
阅读 42
收藏 0
点赞 0
评论 0
/** HttpSessionListener interface */
@Override
public void sessionCreated(HttpSessionEvent sessionEvent) {
if (sessionEvent == null) {
return;
}
HttpSession session = sessionEvent.getSession();
session.setMaxInactiveInterval(SessionListener.timeout);
//set server default locale for STURTS and JSTL. This value should be overwrite
//LocaleFilter class. But this part code can cope with login.jsp Locale.
if (session != null) {
String defaults[] = LanguageUtil.getDefaultLangCountry();
Locale preferredLocale = new Locale(defaults[0] == null ? "" : defaults[0],
defaults[1] == null ? "" : defaults[1]);
session.setAttribute(LocaleFilter.PREFERRED_LOCALE_KEY, preferredLocale);
Config.set(session, Config.FMT_LOCALE, preferredLocale);
}
}
NewSessionListener.java 文件源码
项目:sgroup
阅读 59
收藏 0
点赞 0
评论 0
@Override
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
String sessionId = httpSessionEvent.getSession().getId();
System.out.println("当前销毁的sessionId = " + sessionId);
ServletContext servletContext = httpSessionEvent.getSession().getServletContext();
Object userCount = servletContext.getAttribute("userCount");
if (userCount == null) {
servletContext.setAttribute("userCount", 0);
} else {
servletContext.setAttribute("userCount", Integer.parseInt(userCount.toString()) - 1);
}
}
StandardSession.java 文件源码
项目:lazycat
阅读 28
收藏 0
点赞 0
评论 0
/**
* Inform the listeners about the new session.
*
*/
public void tellNew() {
// Notify interested session event listeners
fireSessionEvent(Session.SESSION_CREATED_EVENT, null);
// Notify interested application event listeners
Context context = (Context) manager.getContainer();
Object listeners[] = context.getApplicationLifecycleListeners();
if (listeners != null) {
HttpSessionEvent event = new HttpSessionEvent(getSession());
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof HttpSessionListener))
continue;
HttpSessionListener listener = (HttpSessionListener) listeners[i];
try {
context.fireContainerEvent("beforeSessionCreated", listener);
listener.sessionCreated(event);
context.fireContainerEvent("afterSessionCreated", listener);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
try {
context.fireContainerEvent("afterSessionCreated", listener);
} catch (Exception e) {
// Ignore
}
manager.getContainer().getLogger().error(sm.getString("standardSession.sessionEvent"), t);
}
}
}
}
SessionListener.java 文件源码
项目:automat
阅读 39
收藏 0
点赞 0
评论 0
public void sessionDestroyed(HttpSessionEvent event) {
HttpSession session = event.getSession();
if (getAllUserNumber() > 0) {
logger.info("销毁了一个Session连接:[" + session.getId() + "]");
}
session.removeAttribute(Constants.CURRENT_USER);
setAllUserNumber(-1);
}
SessionListener.java 文件源码
项目:timesheet-upload
阅读 52
收藏 0
点赞 0
评论 0
@Override
public void sessionCreated(HttpSessionEvent event) {
try {
event.getSession().setMaxInactiveInterval(60 * 60);
} catch (Exception ex) {
log.error("Exception while getting the Max Inactive Interval " + ex);
}
}
StandardSession.java 文件源码
项目:tomcat7
阅读 33
收藏 0
点赞 0
评论 0
/**
* Inform the listeners about the new session.
*
*/
public void tellNew() {
// Notify interested session event listeners
fireSessionEvent(Session.SESSION_CREATED_EVENT, null);
// Notify interested application event listeners
Context context = (Context) manager.getContainer();
Object listeners[] = context.getApplicationLifecycleListeners();
if (listeners != null) {
HttpSessionEvent event =
new HttpSessionEvent(getSession());
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof HttpSessionListener))
continue;
HttpSessionListener listener =
(HttpSessionListener) listeners[i];
try {
context.fireContainerEvent("beforeSessionCreated",
listener);
listener.sessionCreated(event);
context.fireContainerEvent("afterSessionCreated", listener);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
try {
context.fireContainerEvent("afterSessionCreated",
listener);
} catch (Exception e) {
// Ignore
}
manager.getContainer().getLogger().error
(sm.getString("standardSession.sessionEvent"), t);
}
}
}
}
SessionDestroyedCleaner.java 文件源码
项目:dhus-core
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void sessionDestroyed (final HttpSessionEvent event)
{
SecurityContextProvider.removeSecurityContext ((String) event
.getSession ().getAttribute ("integrity"));
super.sessionDestroyed (event);
}
WebSessionListener.java 文件源码
项目:zkAdmin
阅读 40
收藏 0
点赞 0
评论 0
@Override
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) {
Object obj = httpSessionEvent.getSession().getAttribute(Constants.ZOOKEEPER_MANAGER_SESSION_KEY);
if(obj!=null){
((ZookeeperManager)obj).close();
}
logger.trace("session destroy!");
}
SessionListener.java 文件源码
项目:oscm
阅读 40
收藏 0
点赞 0
评论 0
public void sessionDestroyed(HttpSessionEvent event) {
HttpSession session = event.getSession();
sessionMap.remove(session.getId());
ServiceAccess serviceAccess = ServiceAccess
.getServiceAcccessFor(session);
serviceAccess.getService(SessionService.class)
.deleteSessionsForSessionId(event.getSession().getId());
}
SessionEventHttpSessionListenerAdapter.java 文件源码
项目:lemon
阅读 42
收藏 0
点赞 0
评论 0
private HttpSessionEvent createHttpSessionEvent(AbstractSessionEvent event) {
ExpiringSession session = event.getSession();
HttpSession httpSession = new ExpiringSessionHttpSession<ExpiringSession>(session,
this.context);
HttpSessionEvent httpSessionEvent = new HttpSessionEvent(httpSession);
return httpSessionEvent;
}
LogoutHttpSessionListener.java 文件源码
项目:lemon
阅读 41
收藏 0
点赞 0
评论 0
public void sessionDestroyed(HttpSessionEvent se) {
ApplicationContext ctx = WebApplicationContextUtils
.getWebApplicationContext(se.getSession().getServletContext());
if (ctx == null) {
logger.warn("cannot find applicationContext");
return;
}
HttpSession session = se.getSession();
UserAuthDTO userAuthDto = this.internalUserAuthConnector
.findFromSession(session);
String tenantId = null;
if (userAuthDto != null) {
tenantId = userAuthDto.getTenantId();
}
LogoutEvent logoutEvent = new LogoutEvent(session, null,
session.getId(), tenantId);
ctx.publishEvent(logoutEvent);
}
ProxyServletListener.java 文件源码
项目:lemon
阅读 42
收藏 0
点赞 0
评论 0
public void sessionCreated(HttpSessionEvent se) {
if (ctx == null) {
logger.warn("cannot find applicationContext");
return;
}
Collection<HttpSessionListener> httpSessionListeners = ctx
.getBeansOfType(HttpSessionListener.class).values();
for (HttpSessionListener httpSessionListener : httpSessionListeners) {
httpSessionListener.sessionCreated(se);
}
}
ProxyServletListener.java 文件源码
项目:lemon
阅读 44
收藏 0
点赞 0
评论 0
public void sessionDestroyed(HttpSessionEvent se) {
if (ctx == null) {
logger.warn("cannot find applicationContext");
return;
}
Collection<HttpSessionListener> httpSessionListeners = ctx
.getBeansOfType(HttpSessionListener.class).values();
for (HttpSessionListener httpSessionListener : httpSessionListeners) {
httpSessionListener.sessionDestroyed(se);
}
}
UserSessionDestructionListener.java 文件源码
项目:Equella
阅读 45
收藏 0
点赞 0
评论 0
@Override
public void sessionCreated(HttpSessionEvent event)
{
for( HttpSessionListener listener : getListeners() )
{
listener.sessionCreated(event);
}
}
UserSessionDestructionListener.java 文件源码
项目:Equella
阅读 48
收藏 0
点赞 0
评论 0
@Override
public void sessionDestroyed(HttpSessionEvent event)
{
for( HttpSessionListener listener : getListeners() )
{
listener.sessionDestroyed(event);
}
}
UserSessionDestructionListener.java 文件源码
项目:Equella
阅读 41
收藏 0
点赞 0
评论 0
@Override
public void sessionCreated(HttpSessionEvent event)
{
// We don't care about these
if( LOGGER.isDebugEnabled() )
{
final String sessionId = event.getSession().getId();
LOGGER.debug(sessionId + " session created");
}
}
StandardSession.java 文件源码
项目:lams
阅读 30
收藏 0
点赞 0
评论 0
/**
* Inform the listeners about the new session.
*
*/
public void tellNew() {
// Notify interested session event listeners
fireSessionEvent(Session.SESSION_CREATED_EVENT, null);
// Notify interested application event listeners
Context context = (Context) manager.getContainer();
Object listeners[] = context.getApplicationLifecycleListeners();
if (listeners != null) {
HttpSessionEvent event =
new HttpSessionEvent(getSession());
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof HttpSessionListener))
continue;
HttpSessionListener listener =
(HttpSessionListener) listeners[i];
try {
fireContainerEvent(context,
"beforeSessionCreated",
listener);
listener.sessionCreated(event);
fireContainerEvent(context,
"afterSessionCreated",
listener);
} catch (Throwable t) {
try {
fireContainerEvent(context,
"afterSessionCreated",
listener);
} catch (Exception e) {
;
}
manager.getContainer().getLogger().error
(sm.getString("standardSession.sessionEvent"), t);
}
}
}
}
SessionRestoringHandler.java 文件源码
项目:lams
阅读 38
收藏 0
点赞 0
评论 0
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);
}
}
SessionRestoringHandler.java 文件源码
项目:lams
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
final String incomingSessionId = servletContext.getSessionConfig().findSessionId(exchange);
if (incomingSessionId == null || !data.containsKey(incomingSessionId)) {
next.handleRequest(exchange);
return;
}
//we have some old data
PersistentSession result = data.remove(incomingSessionId);
if (result != null) {
long time = System.currentTimeMillis();
if (time < result.getExpiration().getTime()) {
final HttpSessionImpl session = servletContext.getSession(exchange, true);
final HttpSessionEvent event = new HttpSessionEvent(session);
for (Map.Entry<String, Object> entry : result.getSessionData().entrySet()) {
if (entry.getValue() instanceof HttpSessionActivationListener) {
((HttpSessionActivationListener) entry.getValue()).sessionDidActivate(event);
}
if(entry.getKey().startsWith(HttpSessionImpl.IO_UNDERTOW)) {
session.getSession().setAttribute(entry.getKey(), entry.getValue());
} else {
session.setAttribute(entry.getKey(), entry.getValue());
}
}
}
}
next.handleRequest(exchange);
}
ApplicationListeners.java 文件源码
项目:lams
阅读 38
收藏 0
点赞 0
评论 0
public void sessionDestroyed(final HttpSession session) {
final HttpSessionEvent sre = new HttpSessionEvent(session);
for (int i = httpSessionListeners.length - 1; i >= 0; --i) {
ManagedListener listener = httpSessionListeners[i];
this.<HttpSessionListener>get(listener).sessionDestroyed(sre);
}
}
SessionActionsListener.java 文件源码
项目:Spring-web-shop-project
阅读 38
收藏 0
点赞 0
评论 0
@Override
public void sessionCreated(HttpSessionEvent session) {
if (ApplicationProperties.FALSE_WHILE_RUNNING_DB_TESTS) {
HashSet<Book> shopBasket = new HashSet<Book>();
LinkedList<Book> shopBasketUno = new LinkedList<Book>();
session.getSession().setAttribute("basket", shopBasket);
session.getSession().setAttribute("basketWithAllBooks", shopBasketUno);
session.getSession().setAttribute("PROJECT_NAME", ApplicationProperties.PROJECT_NAME);
session.getSession().setAttribute("URL", ApplicationProperties.URL);
}
}
SessionListener.java 文件源码
项目:iBase4J
阅读 35
收藏 0
点赞 0
评论 0
public void sessionDestroyed(HttpSessionEvent event) {
HttpSession session = event.getSession();
if (getAllUserNumber() > 0) {
logger.info("销毁了一个Session连接:[" + session.getId() + "]");
}
session.removeAttribute(Constants.CURRENT_USER);
setAllUserNumber(-1);
}
SessionListener.java 文件源码
项目:unitimes
阅读 35
收藏 0
点赞 0
评论 0
/**
* Listener Event when session is created
*/
public void sessionCreated(HttpSessionEvent se) {
HttpSession session = se.getSession();
sessions.put(session.getId(), session);
activeSessions++;
Debug.info("TT Session started ... " + session.getId() + " " + new Date());
}
SessionListener.java 文件源码
项目:unitimes
阅读 49
收藏 0
点赞 0
评论 0
/**
* Listener Event when session is destroyed
*/
public void sessionDestroyed(HttpSessionEvent se) {
HttpSession session = se.getSession();
sessions.remove(session.getId());
if(activeSessions > 0) {
activeSessions--;
}
Debug.info("TT Session ended ... " + session.getId() + " " + new Date());
Debug.info(" - TT Session time ... " +
( (new Date().getTime() - session.getCreationTime())/(1000*60) ) + " minutes" );
session.invalidate();
}