Package javax.enterprise.context

Examples of javax.enterprise.context.Conversation


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

            if (conversation.isTransient())
            {
                if (logger.isLoggable(Level.FINE))
                {
                    logger.log(Level.FINE, "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
            {
                if (logger.isLoggable(Level.FINE))
                {
                    logger.log(Level.FINE, "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


        Object instance = getBeanManager().getReference(bean, Conversation.class, getBeanManager().createCreationalContext(bean));
       
        OpenWebBeansConfiguration.getInstance().setProperty("org.apache.webbeans.spi.ConversationService", DummyConversationService.class.getName());

        Assert.assertTrue(instance instanceof Conversation);
        Conversation conversation = (Conversation)instance;
        conversation.begin();
       
        Assert.assertTrue(ConversationDecorator.CALLED);
       
        shutDownContainer();
    }
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

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

       
        if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE) ||
                phaseEvent.getFacesContext().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

        }
       
        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

             */
            @Override
            public void sendRedirect(String location) throws IOException
            {
                Bean<?> bean = BeanManagerImpl.getManager().resolveByType(Conversation.class, new DefaultLiteral()).iterator().next();
                Conversation conversation = (Conversation)BeanManagerImpl.getManager().getInstance(bean,null);

                String path = location;

                if (conversation != null)
                {

                    if (!conversation.isTransient())
                    {                       
                        path = JSFUtil.getRedirectViewIdWithCid(location, conversation.getId());
                    }
                }
                               
                super.sendRedirect(path);               

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

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.