Example usage for javax.servlet.http HttpSession getAttribute

List of usage examples for javax.servlet.http HttpSession getAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpSession getAttribute.

Prototype

public Object getAttribute(String name);

Source Link

Document

Returns the object bound with the specified name in this session, or null if no object is bound under the name.

Usage

From source file:be.fedict.eid.idp.sp.protocol.saml2.AuthenticationRequestServlet.java

/**
 * Used by the {@link AbstractAuthenticationResponseServlet} for validation
 * of the SAML v2.0 Response <tt>InResponseTo</tt> field.
 * //from  ww  w. ja  v  a  2s  .  c o  m
 * @param httpSession
 *            the HTTP Session
 * @return the SAML v2.0 Authentication Request ID.
 */
public static String getRequestId(HttpSession httpSession) {
    return (String) httpSession.getAttribute(REQUEST_ID_SESSION_ATTRIBUTE);
}

From source file:be.fedict.eid.idp.sp.protocol.saml2.AuthenticationRequestServlet.java

/**
 * Used by the {@link AbstractAuthenticationResponseServlet} for validation
 * of the SAML v2.0 Assertion Audience Restriction.
 * //from  w w  w .j  a v  a 2 s . c  om
 * @param httpSession
 *            the HTTP Session
 * @return the SAML v2.0 Authentication Request ID.
 */
public static String getRequestIssuer(HttpSession httpSession) {
    return (String) httpSession.getAttribute(REQUEST_ISSUER_SESSION_ATTRIBUTE);
}

From source file:be.fedict.eid.idp.sp.protocol.saml2.AuthenticationRequestServlet.java

/**
 * Used by the {@link AbstractAuthenticationResponseServlet} for validation
 * of the SAML v2.0 Response <tt>AudienceRestriction</tt>.
 * /* w  ww.j a  v  a2 s  .c  o  m*/
 * @param httpSession
 *            the HTTP Session
 * @return the SAML v2.0 Authentication Request AssertionConsumerServiceURL
 */
public static String getRecipient(HttpSession httpSession) {
    return (String) httpSession.getAttribute(RECIPIENT_SESSION_ATTRIBUTE);
}

From source file:be.fedict.eid.idp.sp.protocol.saml2.AuthenticationRequestServlet.java

/**
 * Used by the {@link AbstractAuthenticationResponseServlet} for validation
 * of the SAML v2.0 Response <tt>RelayState</tt>.
 * //w w w.j a  v a2s.com
 * @param httpSession
 *            the HTTP Session
 * @return optional RelayState sent along with the SAML v2.0 Authentication
 *         Request
 */
public static String getRelayState(HttpSession httpSession) {
    return (String) httpSession.getAttribute(RELAY_STATE_SESSION_ATTRIBUTE);
}

From source file:be.fedict.eid.applet.service.impl.handler.SignatureDataMessageHandler.java

public static byte[] getDigestValue(HttpSession session) {
    return (byte[]) session.getAttribute(DIGEST_VALUE_SESSION_ATTRIBUTE);
}

From source file:com.formkiq.core.webflow.FlowManager.java

/**
 * Gets the Next WebFlow Session Id./*ww  w .j a  v a2  s . c o m*/
 * @param req {@link HttpServletRequest}
 * @return int
 */
private static int getNextWebFlowSessionId(final HttpServletRequest req) {

    int sessionId = 1;
    HttpSession session = req.getSession();
    Object sessionOb = session.getAttribute(WEBFLOW_SESSION_ID);

    if (sessionOb != null) {
        try {
            sessionId = Integer.parseInt(sessionOb.toString()) + 1;
        } catch (NumberFormatException e) {
            sessionId = 1;
        }
    }

    session.setAttribute(WEBFLOW_SESSION_ID, String.valueOf(sessionId));

    return sessionId;
}

From source file:com.swiftcorp.portal.common.util.WebUtils.java

public static RoleDTO getUserRole(HttpServletRequest request) {
    HttpSession session = request.getSession();
    UserDTO userDTO = (UserDTO) session.getAttribute(SESSION_KEYS.USER);
    return userDTO.getRole();
}

From source file:com.cubusmail.mail.SessionManager.java

/**
 * @param session/*from w  ww  .  j a  v a 2  s  . com*/
 * @return
 */
public static SessionManager get(HttpSession session) {

    return (SessionManager) session.getAttribute(SESSION_MANAGER_NAME);
}

From source file:com.manydesigns.elements.messages.SessionMessages.java

protected static BlockingQueue<String> getQueue(String queueName) {
    HttpServletRequest req = ElementsThreadLocals.getHttpServletRequest();
    if (req == null) {
        logger.debug("No request available. Returning dummy queue.");
        return new LinkedBlockingQueue<String>();
    }//  w  w w. j  ava 2 s .  c  o  m
    HttpSession session = req.getSession();
    BlockingQueue<String> infoQueue;
    synchronized (session) {
        infoQueue = (BlockingQueue) session.getAttribute(queueName);
        if (infoQueue == null) {
            // install a new queue
            infoQueue = new LinkedBlockingQueue<String>();
            session.setAttribute(queueName, infoQueue);
        }
    }
    return infoQueue;
}

From source file:com.quinsoft.zeidon.utils.JspWebUtils.java

public static String getWebSessionUserId(Object s, TaskQualification qual) {
    HttpSession session = (HttpSession) s;
    String userId = "";

    if (session != null) // try to get the userId from the session if possible
        userId = (String) session.getAttribute("UserId");
    else if (qual != null) {
        Task task = qual.getTask();//  w w  w  . j a va 2 s .c  o  m
        View view = task.getViewByName(WEB_SESSION_VIEW_NAME);
        if (view != null && view.cursor("Session").setFirst("TaskID", task).isSet())
            userId = view.cursor("Session").getAttribute("UserID").getString();
    }

    return userId;
}