Package javax.enterprise.context

Examples of javax.enterprise.context.Conversation


            {
                ConversationManager conversationManager = webBeansContext.getConversationManager();
                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


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

        return conversation;
    }
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

        }

        ConversationContext conversationContext = instance().select(HttpConversationContext.class).get();
        if (!conversationContext.isActive())
            conversationContext.activate(cid);
        Conversation conversation = conversationContext.getCurrentConversation();

        // handle propagation of existing long running converstaions to new
        // targets
        if (!conversation.isTransient()) {
            // Note that we can't propagate conversations with other redirect
            // targets like RequestRedirectTarget through this mechanism, because
            // it does not provide an interface to modify its target URL. If
            // propagation with those targets is to be supported, it needs a custom
            // Response subclass.
            if (isRedirect() && target instanceof BookmarkablePageRequestTarget) {
                BookmarkablePageRequestTarget bookmark = (BookmarkablePageRequestTarget) target;
                // if a cid has already been specified, don't override it
                if (!bookmark.getPageParameters().containsKey("cid"))
                    bookmark.getPageParameters().add("cid", conversation.getId());
            }

            // If we have a target page, propagate the conversation to the page's
            // metadata
            if (page != null) {
                page.setMetaData(SeamMetaData.CID, conversation.getId());
            }
        } else if (cid != null) {
            handleMissingConversation(cid);
        }
View Full Code Here

                }
               
                if(!ok)
                {
                    ConversationManager conversationManager = WebBeansContext.getInstance().getConversationManager();
                    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())
        {
            WebBeansContext webBeansContext = WebBeansContext.getInstance();
            ConversationManager conversationManager = webBeansContext.getConversationManager();
            Conversation conversation = conversationManager.getConversationBeanReference();
            ContextFactory contextFactory = webBeansContext.getContextFactory();

            if (conversation.isTransient())
            {
                if (logger.wblWillLogDebug())
                {
                    logger.debug("Destroying the conversation context with cid : [{0}]", conversation.getId());
                }
                contextFactory.destroyConversationContext();
            }
            else
            {
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
            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.wblWillLogDebug())
                {
                    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
            {
                if (logger.wblWillLogDebug())
                {
                    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 (conversationContext == null) {
            return;
        }

        final ConversationManager conversationManager = webBeansContext.getConversationManager();
        final Conversation conversation = conversationManager.getConversationBeanReference();
        if (conversation == null) {
            return;
        }

        if (conversation.isTransient()) {
            webBeansContext.getContextsService().endContext(ConversationScoped.class, null);
        } else {
            final ConversationImpl conversationImpl = (ConversationImpl) conversation;
            conversationImpl.updateTimeOut();
            conversationImpl.setInUsed(false);
View Full Code Here

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

        return conversation;
    }
View Full Code Here

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

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

        return url;
    }
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.