@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); } } } }
@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); } } } }
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); } } }
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(); } }
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); } } } }
/** 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); } }
@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); } }
/** * 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); } } } }
public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); if (getAllUserNumber() > 0) { logger.info("销毁了一个Session连接:[" + session.getId() + "]"); } session.removeAttribute(Constants.CURRENT_USER); setAllUserNumber(-1); }
@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); } }
/** * 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); } } } }
@Override public void sessionDestroyed (final HttpSessionEvent event) { SecurityContextProvider.removeSecurityContext ((String) event .getSession ().getAttribute ("integrity")); super.sessionDestroyed (event); }
@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!"); }
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()); }
private HttpSessionEvent createHttpSessionEvent(AbstractSessionEvent event) { ExpiringSession session = event.getSession(); HttpSession httpSession = new ExpiringSessionHttpSession<ExpiringSession>(session, this.context); HttpSessionEvent httpSessionEvent = new HttpSessionEvent(httpSession); return httpSessionEvent; }
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); }
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); } }
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); } }
@Override public void sessionCreated(HttpSessionEvent event) { for( HttpSessionListener listener : getListeners() ) { listener.sessionCreated(event); } }
@Override public void sessionDestroyed(HttpSessionEvent event) { for( HttpSessionListener listener : getListeners() ) { listener.sessionDestroyed(event); } }
@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"); } }
/** * 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); } } } }
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); } }
@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); }
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); } }
@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); } }
/** * 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()); }
/** * 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(); }
protected Tracker getTracker(HttpSessionEvent event) { if (iTracker == null) { WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(event.getSession().getServletContext()); iTracker = (Tracker)applicationContext.getBean("unitimeBusySessions"); } return iTracker; }
@Override public void sessionDestroyed(HttpSessionEvent event) { SessionScopeBean sessionScopeBean = WebUtil.getSessionScopeBean(event.getSession()); if (sessionScopeBean != null) { ApplicationScopeBean.unregisterActiveUser(sessionScopeBean.getUser()); } }
@Override public void sessionCreated(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 || "0".equals(userCount)) { servletContext.setAttribute("userCount", 1); } else { servletContext.setAttribute("userCount", Integer.parseInt(userCount.toString()) + 1); } }
public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); if (getAllUserNumber() > 0) { logger.info("销毁了一个Session连接:[" + session.getId() + "]"); } session.removeAttribute(Constants.CURRENT_USER); redisTemplate.opsForSet().remove(Constants.ALLUSER_NUMBER, session.getId()); }
@Override public void sessionCreated(HttpSessionEvent hse) { if (logger.isDebugEnabled()) { logger.debug("Session created " + hse.getSession().getId()); } }
public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); // SImpleSiteVO vo = (SImpleSiteVO) session.getAttribute("SImpleSiteVO"); //当前用户访问的站点信息 RequestLog requestLog = (RequestLog) session.getAttribute("requestLog"); try { //如果为空,应该是没走domain应用的dns.do,那么为空的不予理会 if(requestLog != null && G.aliyunLogUtil != null){ G.aliyunLogUtil.saveByGroup(requestLog.getServerName(), requestLog.getIp(), requestLog.getLogGroup()); } } catch (LogException e) { e.printStackTrace(); } }
@Override public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); // session has been invalidated and all session data (except Id)is no longer available if (log.isDebugEnabled()) { log.debug(getTime() + " (session) Destroyed:ID=" + session.getId()); } }
@Override public void sessionDestroyed(HttpSessionEvent event) { System.out.println("app session destroyed"); }