Package javax.enterprise.context

Examples of javax.enterprise.context.Conversation


        }
       
        String url = delegate.getActionURL(context, viewId);

        ConversationManager conversationManager = ConversationManager.getInstance();
        Conversation conversation = conversationManager.getConversationBeanReference();
        if (conversation != null && !conversation.isTransient())
        {
            url = JSFUtil.getRedirectViewIdWithCid(url, conversation.getId());
        }

        return url;
    }
View Full Code Here


            {
                return url;
            }
        }
        ConversationManager conversationManager = ConversationManager.getInstance();
        Conversation conversation = conversationManager.getConversationBeanReference();
        if (conversation != null && !conversation.isTransient())
        {
            url = JSFUtil.getRedirectViewIdWithCid(url, conversation.getId());
        }
        return url;
    }
View Full Code Here

            {
                ConversationManager conversationManager = ConversationManager.getInstance();
                java.util.Iterator<Conversation> it = conversationContextMap.keySet().iterator();
                while(it.hasNext())
                {
                    Conversation c = it.next();
                    ConversationContext cc = conversationContextMap.get(c);
                    conversationManager.addConversationContext(c, cc);
                }
            }
        }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected Conversation createInstance(CreationalContext<Conversation> creationalContext)
    {
        Conversation conversation = null;
        //Gets conversation service
        ConversationService conversationService = ServiceLoader.getService(ConversationService.class);       
        //Gets conversation id
        String conversationId = conversationService.getConversationId();      
        //Gets session id that conversation is created
View Full Code Here

    @SuppressWarnings("unchecked")
    public Conversation getConversationBeanReference()
    {
        BeanManager beanManager = BeanManagerImpl.getManager();
        Bean<Conversation> bean = (Bean<Conversation>)beanManager.getBeans(Conversation.class, new DefaultLiteral()).iterator().next();
        Conversation conversation =(Conversation) beanManager.getReference(bean, Conversation.class, beanManager.createCreationalContext(bean));

        return conversation;
    }
View Full Code Here

            {
                return;
            }
           
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();

            if (conversation.isTransient())
            {
                logger.debug("Destroying the conversation context with cid : [{0}]", conversation.getId());
                ContextFactory.destroyConversationContext();                                                   
            }
            else
            {
                //Conversation must be used by one thread at a time
View Full Code Here

        {
            //It looks for cid parameter in the JSF request.
            //If request contains cid, then it must restore conversation
            //Otherwise create NonexistentException
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();
            String cid = JSFUtil.getConversationId();

            if (conversation.isTransient())
            {
                logger.debug("Creating a new transitional conversation with cid : [{0}]", conversation.getId());
                ContextFactory.initConversationContext(null);

                //Not restore, throw exception
                if(cid != null && !cid.equals(""))
                {
                    throw new NonexistentConversationException("Propogated conversation with cid=" + cid + " is not restored. It creates a new transient conversation.");
                }
            }
            else
            {
                logger.debug("Restoring conversation with cid : [{0}]", conversation.getId());

                //Conversation must be used by one thread at a time
                ConversationImpl owbConversation = (ConversationImpl)conversation;
                if(!owbConversation.getInUsed().compareAndSet(false, true))
                {
View Full Code Here

       
        if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE) ||
                JSFUtil.getCurrentFacesContext().getResponseComplete())
        {
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();

            if (conversation.isTransient())
            {
                logger.debug("Destroying the conversation context with cid : [{0}]", conversation.getId());
                ContextFactory.destroyConversationContext();                                                   
            }
            else
            {
                //Conversation must be used by one thread at a time
View Full Code Here

        {
            //It looks for cid parameter in the JSF request.
            //If request contains cid, then it must restore conversation
            //Otherwise create NonexistentException
            ConversationManager conversationManager = ConversationManager.getInstance();
            Conversation conversation = conversationManager.getConversationBeanReference();
            String cid = JSFUtil.getConversationId();

            if (conversation.isTransient())
            {
                logger.debug("Creating a new transitional conversation with cid : [{0}]", conversation.getId());
                ContextFactory.initConversationContext(null);

                //Not restore, throw exception
                if(cid != null && !cid.equals(""))
                {
                    throw new NonexistentConversationException("Propogated conversation with cid=" + cid + " is not restored. It creates a new transient conversation.");
                }
            }
            else
            {
                logger.debug("Restoring conversation with cid : [{0}]", conversation.getId());

                //Conversation must be used by one thread at a time
                ConversationImpl owbConversation = (ConversationImpl)conversation;
                if(!owbConversation.getInUsed().compareAndSet(false, true))
                {
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected Conversation createInstance(CreationalContext<Conversation> creationalContext)
    {
        Conversation conversation = null;
        //Gets conversation service
        ConversationService conversationService = ServiceLoader.getService(ConversationService.class);       
        //Gets conversation id
        String conversationId = conversationService.getConversationId();      
        //Gets session id that conversation is created
View Full Code Here

TOP

Related Classes of javax.enterprise.context.Conversation

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.