protected HttpSession getHttpSession() {

    RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();

    if (requestAttributes != null && requestAttributes instanceof ServletRequestAttributes) {

      HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();

      return request == null ? null : request.getSession(true);
    }
    return null;
  }
Get the current session.

@return the current session
ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariSessionManager.java