Package org.apache.webbeans.context

Examples of org.apache.webbeans.context.SessionContext


     * Get current session ctx.
     * @return session context
     */
    private  SessionContext getSessionContext()
    {
        SessionContext context = sessionContext.get();
        if (null == context)
        {
            lazyStartSessionContext();
            context = sessionContext.get();
        }
View Full Code Here


     * Creates the session context at the session start.
     * @param session http session object
     */
    private void initSessionContext(HttpSession session)
    {
        SessionContext currentSessionContext;

        if (session == null)
        {
            // no session -> create a dummy SessionContext
            // this is handy if you create asynchronous tasks or
            // batches which use a 'admin' user.
            currentSessionContext = new SessionContext();
        }
        else
        {
            String sessionId = session.getId();

            //Current context
            currentSessionContext = sessionCtxManager.getSessionContextWithSessionId(sessionId);

            //No current context
            if (currentSessionContext == null)
            {
                currentSessionContext = new SessionContext();
                sessionCtxManager.addNewSessionContext(sessionId, currentSessionContext);
            }
        }

        //Activate
        currentSessionContext.setActive(true);

        //Set thread local
        sessionContexts.set(currentSessionContext);
    }
View Full Code Here

    private void destroySessionContext(HttpSession session)
    {
        if (session != null)
        {
            //Get current session context
            SessionContext context = sessionContexts.get();

            //Destroy context
            if (context != null)
            {
                context.destroy();
            }

            //Clear thread locals
            sessionContexts.set(null);
            sessionContexts.remove();
View Full Code Here

     * Get current session ctx.
     * @return session context
     */
    private  SessionContext getSessionContext()
    {
        SessionContext context = sessionContexts.get();
        if (null == context)
        {
            lazyStartSessionContext();
            context = sessionContexts.get();
        }
View Full Code Here

     */
    private void initSessionContext(HttpSession session)
    {
        String sessionId = session.getId();
        //Current context
        SessionContext currentSessionContext = sessionCtxManager.getSessionContextWithSessionId(sessionId);
       
        //No current context
        if (currentSessionContext == null)
        {
            currentSessionContext = new SessionContext();
            sessionCtxManager.addNewSessionContext(sessionId, currentSessionContext);
        }

        //Activate
        currentSessionContext.setActive(true);
       
        //Set thread local
        sessionContext.set(currentSessionContext);
    }
View Full Code Here

     * @param session http session object
     */
    private void destroySessionContext(HttpSession session)
    {
        //Get current session context
        SessionContext context = getSessionContext();
       
        //Destroy context
        if (context != null)
        {
            context.destroy();
        }

        //Clear thread locals
        sessionContext.set(null);
        sessionContext.remove();
View Full Code Here

    public void updateSessionIdMapping(final String oldId, final String newId) {
        if (oldId == null) {
            return;
        }

        final SessionContext sc = getSessionContextWithSessionId(oldId);
        if (sc == null) {
            return;
        }

        addNewSessionContext(newId, sc);
View Full Code Here

            return;
        }

        String sessionId = session.getId();
        //Current context
        SessionContext currentSessionContext = sessionCtxManager.getSessionContextWithSessionId(sessionId);

        //No current context
        if (currentSessionContext == null) {
            currentSessionContext = newSessionContext(session);
            sessionCtxManager.addNewSessionContext(sessionId, currentSessionContext);
        }
        //Activate
        currentSessionContext.setActive(true);

        //Set thread local
        sessionContext.set(currentSessionContext);
    }
View Full Code Here

            } catch (Exception e) {
                logger.error("Can't instantiate " + classname + ", using default session context", e);
            }
        }
        return new SessionContext();
    }
View Full Code Here

     * @param session http session object
     */
    private void destroySessionContext(HttpSession session) {
        if (session != null) {
            //Get current session context
            SessionContext context = sessionContext.get();

            //Destroy context
            if (context != null) {
                context.destroy();
            }

            //Clear thread locals
            sessionContext.set(null);
            sessionContext.remove();
View Full Code Here

TOP

Related Classes of org.apache.webbeans.context.SessionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.