Example usage for javax.servlet.http HttpServletRequest changeSessionId

List of usage examples for javax.servlet.http HttpServletRequest changeSessionId

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest changeSessionId.

Prototype

public String changeSessionId();

Source Link

Document

Change the session id of the current session associated with this request and return the new session id.

Usage

From source file:org.structr.core.auth.AuthHelper.java

public static void doLogout(final HttpServletRequest request, final Principal user) throws FrameworkException {

    final HttpSession session = request.getSession(false);

    // We need a session to logout a user
    if (session != null) {

        AuthHelper.clearSession(session.getId());
        user.removeSessionId(session.getId());

        Actions.call(Actions.NOTIFICATION_LOGOUT, user);

        try {//from  www. ja  v  a2  s.c  o m
            request.logout();
            request.changeSessionId();
        } catch (Throwable t) {
        }

    }
}

From source file:org.structr.rest.auth.AuthHelper.java

public static void doLogout(final HttpServletRequest request, final Principal user) throws FrameworkException {

    final HttpSession session = request.getSession(false);

    // We need a session to logout a user
    if (session != null) {

        SessionHelper.clearSession(session.getId());

        SessionHelper.invalidateSession(session);

        Actions.call(Actions.NOTIFICATION_LOGOUT, user);

        try {// w  w w . ja  va 2 s.c  om
            request.logout();
            request.changeSessionId();
        } catch (Throwable t) {
        }

    }
}

From source file:org.structr.rest.auth.SessionHelper.java

public static void newSession(final HttpServletRequest request) {

    if (request.getSession(true) == null) {

        if (request instanceof UpgradeHttpServletRequest) {
            logger.debug("Requested to create a new session on a Websocket request, aborting");
            return;
        }/*  w  w  w. j  a v a2 s. c  om*/

        request.changeSessionId();
    }

    if (request.getSession(false) != null) {

        logger.debug("Created new session " + request.getSession(false).getId());
    } else {

        logger.warn("Request still has no valid session");
    }
}