Package javax.enterprise.context

Examples of javax.enterprise.context.Conversation


             */
            @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


    public void afterPhase(PhaseEvent phaseEvent)
    {
        if (phaseEvent.getPhaseId().equals(PhaseId.RENDER_RESPONSE) ||
                JSFUtil.getCurrentFacesContext().getResponseComplete())
        {
          Conversation conversation = conversationManager.getConversationBeanReference();
         
            if (conversation.isTransient())
            {
                logger.info(OWBLogConst.INFO_0014, new Object[]{conversation.getId()});
                ContextFactory.destroyConversationContext();                                                   
            }
            else
            {
                //Conversation must be used by one thread at a time
View Full Code Here

        if (phaseEvent.getPhaseId().equals(PhaseId.RESTORE_VIEW))
        {
            //It looks for cid parameter in the JSF request.
            //If request contains cid, then it must restore conversation
            //Otherwise create NonexistentException
          Conversation conversation = conversationManager.getConversationBeanReference();
          String cid = JSFUtil.getConversationId();
         
      if (conversation.isTransient())
      {
        logger.info(OWBLogConst.INFO_0016, new Object[]{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.info(OWBLogConst.INFO_0015, new Object[]{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

    @Override
    public String getActionURL(FacesContext context, String viewId)
    {
        String url = delegate.getActionURL(context, viewId);

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

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

    if (cid == null && page != null)
    {
      cid = page.getMetaData(CID_KEY);
    }

    Conversation current = getConversation(cycle);
    if (current != null && !Objects.isEqual(current.getId(), cid))
    {
      logger.info("Conversation {} has expired for {}", cid, page);
      throw new ConversationExpiredException(null, cid, page, handler);
    }
View Full Code Here

  }

  private void activateConversationIfNeeded(RequestCycle cycle, IRequestHandler handler,
    String cid)
  {
    Conversation current = getConversation(cycle);

    if (current != null || !activateForHandler(handler))
    {
      return;
    }
View Full Code Here

  }

  @Override
  public void onRequestHandlerExecuted(RequestCycle cycle, IRequestHandler handler)
  {
    Conversation conversation = getConversation(cycle);

    if (conversation == null || conversation.isTransient())
    {
      return;
    }

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.