List of usage examples for javax.servlet.http HttpSessionEvent getSession
public HttpSession getSession()
From source file:it.scoppelletti.programmerpower.web.spring.ApplicationContextListener.java
/** * Inizializzazione di una sessione./* w ww. j av a2 s . c o m*/ * * @param event Evento. */ public void sessionCreated(HttpSessionEvent event) { HttpSession session = event.getSession(); EventContext eventCtx = null; if (mySessionListeners == null) { return; } try { eventCtx = new EventContext(ApplicationContextListener.THREAD_SESSION_CREATE, session.getServletContext()); for (Map.Entry<String, HttpSessionListener> entry : mySessionListeners.entrySet()) { myLogger.trace("Calling method sessionCreated({}) of " + "HttpSessionListener {}.", session.getId(), entry.getKey()); try { entry.getValue().sessionCreated(event); } catch (Exception ex) { myLogger.error(entry.getKey(), ex); } } } finally { if (eventCtx != null) { eventCtx.dispose(); eventCtx = null; } } }
From source file:it.scoppelletti.programmerpower.web.spring.ApplicationContextListener.java
/** * Termine di una sessione.//from ww w .j a v a 2 s .c om * * @param event Evento. */ public void sessionDestroyed(HttpSessionEvent event) { HttpSession session = event.getSession(); EventContext eventCtx = null; if (mySessionListeners == null) { return; } try { eventCtx = new EventContext(ApplicationContextListener.THREAD_SESSION_DESTROY, session.getServletContext()); for (Map.Entry<String, HttpSessionListener> entry : mySessionListeners.entrySet()) { myLogger.trace("Calling method sessionDestroyed({}) of " + "HttpSessionListener {}.", session.getId(), entry.getKey()); try { entry.getValue().sessionDestroyed(event); } catch (Exception ex) { myLogger.error(entry.getKey(), ex); } } } finally { if (eventCtx != null) { eventCtx.dispose(); eventCtx = null; } } }
From source file:org.hdiv.listener.InitWebSphereListener.java
/** * @see javax.servlet.http.HttpSessionListener#void * (javax.servlet.http.HttpSessionEvent) */// w ww. ja va2s. com public void sessionDestroyed(HttpSessionEvent arg0) { HDIVUtil.resetLocalData(); if (log.isInfoEnabled()) { log.info("HDIV's session destroyed:" + arg0.getSession().getId()); } }
From source file:org.hdiv.listener.InitWebSphereListener.java
/** * Cache initialization./*w ww. j a v a 2s . c om*/ * @param wac web application context * @param httpSessionEvent http session event */ private void initCache(WebApplicationContext wac, HttpSessionEvent httpSessionEvent) { IStateCache cache = (IStateCache) wac.getBean("cache"); String cacheName = (String) wac.getBean("cacheName"); httpSessionEvent.getSession().setAttribute((cacheName == null) ? Constants.CACHE_NAME : cacheName, cache); }
From source file:wqm.radio.StationManager.java
public void sessionDestroyed(HttpSessionEvent event) { logger.error("Session Destroyed"); try {// www .j av a 2 s . co m HttpSession session = event.getSession(); quitCalibrationPhase(session, getStation(session), getSensor(session)); getStation(session).setLocked(false); unlock(session, getStation(session)); } catch (Throwable t) { logger.error("Error unlocking station", t); } }
From source file:com.manydesigns.portofino.servlets.PortofinoListener.java
public void sessionCreated(HttpSessionEvent httpSessionEvent) { HttpSession session = httpSessionEvent.getSession(); logger.debug("Session created: id={}", session.getId()); }
From source file:com.manydesigns.portofino.servlets.PortofinoListener.java
public void sessionDestroyed(HttpSessionEvent httpSessionEvent) { HttpSession session = httpSessionEvent.getSession(); logger.debug("Session destroyed: id={}", session.getId()); }
From source file:fr.univlorraine.mondossierweb.Initializer.java
/** * @see org.springframework.web.WebApplicationInitializer#onStartup(javax.servlet.ServletContext) *//*from w w w . j a v a 2 s . com*/ @Override public void onStartup(ServletContext servletContext) throws ServletException { addContextParametersToSystemProperties(servletContext); /* Configure les sessions */ Set<SessionTrackingMode> sessionTrackingModes = new HashSet<SessionTrackingMode>(); sessionTrackingModes.add(SessionTrackingMode.COOKIE); servletContext.setSessionTrackingModes(sessionTrackingModes); servletContext.addListener(new HttpSessionListener() { @Override public void sessionCreated(HttpSessionEvent httpSessionEvent) { // sans nouvelle requte, on garde la session active 4 minutes httpSessionEvent.getSession().setMaxInactiveInterval(240); } @Override public void sessionDestroyed(HttpSessionEvent httpSessionEvent) { } }); /* Gestion des sessions dans Atmosphere (Push Vaadin) */ servletContext.addListener(SessionSupport.class); /* Configure Spring */ AnnotationConfigWebApplicationContext springContext = new AnnotationConfigWebApplicationContext(); if (!Boolean.valueOf(servletContext.getInitParameter(Constants.SERVLET_PARAMETER_PRODUCTION_MODE))) { springContext.getEnvironment().setActiveProfiles(DEBUG_PROFILE); } springContext.register(SpringConfig.class); servletContext.addListener(new ContextLoaderListener(springContext)); servletContext.addListener(new RequestContextListener()); /* Filtre Spring Security */ FilterRegistration.Dynamic springSecurityFilterChain = servletContext.addFilter("springSecurityFilterChain", DelegatingFilterProxy.class); springSecurityFilterChain.addMappingForUrlPatterns(null, false, "/*"); /* Filtre passant l'utilisateur courant Logback */ FilterRegistration.Dynamic userMdcServletFilter = servletContext.addFilter("userMdcServletFilter", UserMdcServletFilter.class); userMdcServletFilter.addMappingForUrlPatterns(null, false, "/*"); /* Filtre Spring Mobile permettant de dtecter le device */ FilterRegistration.Dynamic springMobileServletFilter = servletContext .addFilter("deviceResolverRequestFilter", DeviceResolverRequestFilter.class); springMobileServletFilter.addMappingForUrlPatterns(null, false, "/*"); /* Servlet Spring-Vaadin */ //ServletRegistration.Dynamic springVaadinServlet = servletContext.addServlet("springVaadin", JMeterServlet.class); //ServletRegistration.Dynamic springVaadinServlet = servletContext.addServlet("springVaadin", SpringVaadinServlet.class); ServletRegistration.Dynamic springVaadinServlet = servletContext.addServlet("springVaadin", fr.univlorraine.mondossierweb.utils.MdwSpringVaadinServlet.class); springVaadinServlet.setLoadOnStartup(1); springVaadinServlet.addMapping("/*"); /* Dfini le bean UI */ //springVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_UI_PROVIDER, "fr.univlorraine.mondossierweb.MdwUIProvider"); /* Utilise les messages Spring pour les messages d'erreur Vaadin (cf. http://vaadin.xpoft.ru/#system_messages) */ springVaadinServlet.setInitParameter("systemMessagesBeanName", "DEFAULT"); /* Dfini la frquence du heartbeat en secondes (cf. https://vaadin.com/book/vaadin7/-/page/application.lifecycle.html#application.lifecycle.ui-expiration) */ springVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_HEARTBEAT_INTERVAL, String.valueOf(30)); /* Configure le Push */ springVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_PUSH_MODE, Boolean.valueOf(servletContext.getInitParameter("enablePush")) ? PushMode.AUTOMATIC.name() : PushMode.DISABLED.name()); /* Active le support des servlet 3 et des requtes asynchrones (cf. https://vaadin.com/wiki/-/wiki/Main/Working+around+push+issues) */ springVaadinServlet.setInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT_SERVLET3, String.valueOf(true)); /* Active le support des requtes asynchrones */ springVaadinServlet.setAsyncSupported(true); /* Ajoute l'interceptor Atmosphere permettant de restaurer le SecurityContext dans le SecurityContextHolder (cf. https://groups.google.com/forum/#!msg/atmosphere-framework/8yyOQALZEP8/ZCf4BHRgh_EJ) */ springVaadinServlet.setInitParameter(ApplicationConfig.ATMOSPHERE_INTERCEPTORS, RecoverSecurityContextAtmosphereInterceptor.class.getName()); /* Spring-Vaadin Touchkit Servlet */ ServletRegistration.Dynamic springTouchkitVaadinServlet = servletContext.addServlet("springTouchkitVaadin", MDWTouchkitServlet.class); //springTouchkitVaadinServlet.setLoadOnStartup(1); springTouchkitVaadinServlet.addMapping("/m/*"); /* Dfini le bean UI */ //springTouchkitVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_UI_PROVIDER, "fr.univlorraine.mondossierweb.MdwTouchkitUIProvider"); /* Utilise les messages Spring pour les messages d'erreur Vaadin (cf. http://vaadin.xpoft.ru/#system_messages) */ springTouchkitVaadinServlet.setInitParameter("systemMessagesBeanName", "DEFAULT"); springTouchkitVaadinServlet.setInitParameter(Constants.PARAMETER_WIDGETSET, "fr.univlorraine.mondossierweb.AppWidgetset"); /* Configure le Push */ springTouchkitVaadinServlet.setInitParameter(Constants.SERVLET_PARAMETER_PUSH_MODE, PushMode.DISABLED.name()); /* Active le support des servlet 3 et des requtes asynchrones (cf. https://vaadin.com/wiki/-/wiki/Main/Working+around+push+issues) */ springTouchkitVaadinServlet.setInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT_SERVLET3, String.valueOf(true)); /* Active le support des requtes asynchrones */ springTouchkitVaadinServlet.setAsyncSupported(true); /* Ajoute l'interceptor Atmosphere permettant de restaurer le SecurityContext dans le SecurityContextHolder (cf. https://groups.google.com/forum/#!msg/atmosphere-framework/8yyOQALZEP8/ZCf4BHRgh_EJ) */ springTouchkitVaadinServlet.setInitParameter(ApplicationConfig.ATMOSPHERE_INTERCEPTORS, RecoverSecurityContextAtmosphereInterceptor.class.getName()); }
From source file:org.ejbca.ra.RaAuthenticationBean.java
/** Invoked from RaHttpSessionListener when a session expires/is destroyed */ public void onSessionDestroyed(final HttpSessionEvent httpSessionEvent) { log.info("HTTP session from client with authentication " + authenticationToken + " ended."); if (log.isDebugEnabled()) { log.debug("HTTP session from client with authentication " + authenticationToken + " ended. jsessionid=" + httpSessionEvent.getSession().getId()); }/*from w ww . ja va 2 s . com*/ // Insert additional clean up (if any) needed on logout. // (Note that FacesContext is not available any more, but injected SSBs or bean fetched via httpSessionEvent.getSession().getAttribute("beanName") still can be used.) }
From source file:org.b3log.symphony.SymphonyServletListener.java
@Override public void sessionDestroyed(final HttpSessionEvent httpSessionEvent) { final HttpSession session = httpSessionEvent.getSession(); final Object userObj = session.getAttribute(User.USER); if (null != userObj) { // User logout final JSONObject user = (JSONObject) userObj; final UserMgmtService userMgmtService = beanManager.getReference(UserMgmtService.class); try {/*w ww . java 2 s . c o m*/ userMgmtService.updateOnlineStatus(user.optString(Keys.OBJECT_ID), "", false); } catch (final ServiceException e) { LOGGER.log(Level.ERROR, "Changes user online from [true] to [false] failed", e); } } super.sessionDestroyed(httpSessionEvent); }