List of usage examples for com.vaadin.server SessionDestroyEvent getSession
public VaadinSession getSession()
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
/** * Init UI//from ww w. j a v a 2 s . co m * * @param request vaadin request */ @Override protected void init(VaadinRequest request) { setLocale(Locale.US); getPage().setTitle("Welcome to " + consoleName); setContent(root); root.addStyleName("root"); root.setSizeFull(); Label bg = new Label(); bg.setSizeUndefined(); bg.addStyleName("login-bg"); root.addComponent(bg); Boolean isLogged = (Boolean) getSession().getAttribute("is.logged"); if (!enableSecurity || (isLogged != null && isLogged)) { securityManager = (ISecurityManager) getSession().getAttribute("security.manager"); if (securityManager == null) { Subject defaultSubject = new Subject(); defaultSubject.getPrincipals().add(new UserPrincipal(ANONYMOUS_USER)); RoleGroup group = new RoleGroup(); if (defaultRoles != null) { for (String role : defaultRoles) { group.addMember(new RolePrincipal(role)); } } defaultSubject.getPrincipals().add(group); defaultSubject.setReadOnly(); securityManager = new SecurityManager(defaultSubject); getSession().setAttribute("security.manager", securityManager); getSession().getService().addSessionDestroyListener(new SessionDestroyListener() { @Override public void sessionDestroy(SessionDestroyEvent sessionDestroyEvent) { sessionDestroyEvent.getSession().getSession().removeAttribute("security.manager"); } }); } buildMainView(); } else { // Cookie userCookie = getCookieByName(PEERGREEN_USER_COOKIE_NAME); // if (userCookie != null) { // String token = userCookie.getValue(); // // get user by token and show main view // } buildLoginView(false); } }
From source file:edu.nps.moves.mmowgli.Mmowgli2VaadinServlet.java
License:Open Source License
@Override public void sessionDestroy(SessionDestroyEvent event) { MSysOut.println(SYSTEM_LOGS, "JMETERdebug: Session destroyed, id = " + event.getSession().hashCode()); MmowgliSessionGlobals globs = event.getSession().getAttribute(MmowgliSessionGlobals.class); if (globs != null) globs.vaadinSessionClosing();//w w w . ja v a 2 s . c o m if (appMaster != null) { // might be with error on startup appMaster.doSessionCountUpdate(decrementSessionCount()); if (globs != null) appMaster.sessionEndingFromTimeoutOrLogout(globs, event.getSession()); } }
From source file:org.vaadin.tori.ToriApiLoader.java
License:Apache License
@Override public void sessionDestroy(final SessionDestroyEvent event) { if (sessionId != null && sessionId.equals(event.getSession().getSession().getId())) { if (toriActivityMessaging != null) { toriActivityMessaging.deregister(); }/* w w w. j a v a 2s. co m*/ event.getService().removeSessionDestroyListener(this); } }