Example usage for org.apache.shiro.web.servlet ShiroHttpServletRequest REFERENCED_SESSION_IS_NEW

List of usage examples for org.apache.shiro.web.servlet ShiroHttpServletRequest REFERENCED_SESSION_IS_NEW

Introduction

In this page you can find the example usage for org.apache.shiro.web.servlet ShiroHttpServletRequest REFERENCED_SESSION_IS_NEW.

Prototype

String REFERENCED_SESSION_IS_NEW

To view the source code for org.apache.shiro.web.servlet ShiroHttpServletRequest REFERENCED_SESSION_IS_NEW.

Click Source Link

Usage

From source file:org.sonatype.nexus.security.StatelessAndStatefulWebSessionManager.java

License:Open Source License

@Override
protected void onStart(Session session, SessionContext context) {
    if (!WebUtils.isHttp(context)) {
        log.debug("SessionContext argument is not HTTP compatible or does not have an HTTP request/response "
                + "pair. No session ID cookie will be set.");
        return;//from w  ww  .  j  a v  a 2  s. co m

    }
    HttpServletRequest request = WebUtils.getHttpRequest(context);
    HttpServletResponse response = WebUtils.getHttpResponse(context);

    if (isSessionIdCookieEnabled(request, response)) {
        Serializable sessionId = session.getId();
        storeSessionId(sessionId, request, response);
    } else {
        log.debug("Session ID cookie is disabled.  No cookie has been set for new session with id {}",
                session.getId());
    }

    request.removeAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_SOURCE);
    request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_IS_NEW, Boolean.TRUE);
}