Example usage for com.vaadin.server VaadinSession close

List of usage examples for com.vaadin.server VaadinSession close

Introduction

In this page you can find the example usage for com.vaadin.server VaadinSession close.

Prototype

public void close() 

Source Link

Document

Sets this session to be closed and all UI state to be discarded at the end of the current request, or at the end of the next request if there is no ongoing one.

Usage

From source file:edu.nps.moves.mmowgli.AbstractMmowgliControllerHelper2.java

License:Open Source License

private void doLogOutIn8SecondsTL() {
    Thread thr = new Thread("KickoutThread") {
        @Override/*w w w.  j  av  a2s  .  co  m*/
        public void run() {
            try {
                Thread.sleep(8 * 1000);
                VaadinSession sess = Mmowgli2UI.getAppUI().getSession();
                HSess.init();
                GameLinks links = GameLinks.getTL();
                HSess.close();
                final String terms = links.getTermsLink();

                for (final UI ui : sess.getUIs())
                    ui.access(new Runnable() {
                        public void run() {
                            ui.getPage().setLocation(terms);
                        }
                    });
                sess.close(); // bye bye
            } catch (InterruptedException ex) {
            }
        }
    };
    thr.setPriority(Thread.NORM_PRIORITY);
    thr.start();
}

From source file:edu.nps.moves.mmowgli.AppMaster.java

License:Open Source License

public void killAllSessionsTL() {
    GameLinks links = GameLinks.getTL();
    String thanks = links.getThanksForPlayingLink();

    synchronized (sessionsInThisMmowgliNode) {
        Iterator<VaadinSession> itr = sessionsInThisMmowgliNode.iterator();
        while (itr.hasNext()) {
            VaadinSession sess = itr.next();
            for (UI ui : sess.getUIs()) {
                ui.getPage().setLocation(thanks);
                ui.close();//ww w  . j  av  a  2 s  .  c om
            }
            sess.close();
        }
    }
}

From source file:fr.univlorraine.mondossierweb.controllers.UiController.java

License:Apache License

/**
 * Ferme une session
 * @param session
 */
public void killSession(VaadinSession session) {
    session.close();
}

From source file:org.ikasan.dashboard.ui.framework.action.LogoutAction.java

License:BSD License

@Override
public void exectuteAction() {
    VaadinService.getCurrentRequest().getWrappedSession().setAttribute(DashboardSessionValueConstants.USER,
            null);/*from   w w  w .  ja  v  a2s  . c om*/
    this.visibilityGroup.setVisible();
    this.editableGroup.setEditable(false);

    layout.removeComponent(this.logOutButton);
    layout.addComponent(this.loginButton, 2, 0);
    layout.addComponent(this.setupButton, 3, 0);
    layout.setComponentAlignment(this.setupButton, Alignment.MIDDLE_RIGHT);
    layout.setComponentAlignment(this.loginButton, Alignment.MIDDLE_RIGHT);
    this.layout.removeComponent(userLabel);

    VaadinSession vSession = VaadinSession.getCurrent();
    WrappedSession httpSession = vSession.getSession();

    this.navigationPanel.reset();

    //Invalidate HttpSession
    httpSession.invalidate();
    vSession.close();
    //Redirect the user to the login/default Page
    Page.getCurrent().setLocation("/ikasan-dashboard");
}

From source file:org.vaadin.spring.security.shared.VaadinSessionClosingLogoutHandler.java

License:Apache License

@Override
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
    try {//from  w w w .  jav  a 2  s. c o m
        LOGGER.debug("Logging out and closing all Vaadin sessions");
        Collection<VaadinSession> allSessions = VaadinSession.getAllSessions(request.getSession());
        for (VaadinSession session : allSessions) {
            LOGGER.debug("Closing session [{}]", session);
            session.close();
        }
    } catch (Exception ex) {
        LOGGER.error("An exception occurred while attempting to close the Vaadin sessions", ex);
    }
}