Package javax.enterprise.context

Examples of javax.enterprise.context.Conversation


    @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


            } catch (ContextNotActiveException e) {
                activeBeforeApplyRequestValues = false;
            }
        }
        if (event.getPhaseId().equals(PhaseId.RENDER_RESPONSE)) {
            Conversation conversation = CDI.current().select(Conversation.class).get();
            HttpServletResponse response = (HttpServletResponse) event.getFacesContext().getExternalContext().getResponse();
            response.addHeader(AbstractConversationTest.CID_HEADER_NAME,
                    conversation.getId() == null ? " null" : conversation.getId());
            response.addHeader(AbstractConversationTest.LONG_RUNNING_HEADER_NAME, String.valueOf(!conversation.isTransient()));
            response.addHeader(Cloud.RAINED_HEADER_NAME, new Boolean(OldSPIBridge.getInstanceByType(beanManager, Cloud.class)
                    .isRained()).toString());
            response.addHeader(ACTIVE_BEFORE_APPLY_REQUEST_VALUES_HEADER_NAME,
                    new Boolean(activeBeforeApplyRequestValues).toString());
        }
View Full Code Here

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method = req.getParameter("method");
        if ("cid".equals(method)) {
            Conversation conversation = OldSPIBridge.getInstanceByType(beanManager, Conversation.class);
            serializeToResponse(conversation.getId(), resp);
        } else if ("cloudDestroyed".equals(method)) {
            if (Cloud.isDestroyed()) {
                resp.setStatus(HttpServletResponse.SC_OK);
            } else {
                resp.setStatus(208);
View Full Code Here

    */
   public void callback(Context context, Event event) throws Exception
   {
      WeldManager manager = context.get(WeldManager.class);
     
      Conversation conversation = Utils.getBeanReference(manager, Conversation.class);
      if(!conversation.isTransient())
      {
         context.add(CDIConversationID.class, new CDIConversationID(conversation.getId()));
      }
      else
      {
         context.add(CDIConversationID.class, new CDIConversationID(null));
      }
View Full Code Here

    {
        ConversationService conversationService = ServiceLoader.getService(ConversationService.class);
       
        String conversationId = conversationService.getConversationId();
       
        Conversation conversation = null;

        if (conversationId != null)
        {
            conversation = ConversationManager.getInstance().getConversation(conversationId);
        }
View Full Code Here

        }
    }

    public Conversation createNewConversation()
    {
        Conversation conversation = getCurrentConversation();

        return conversation;

    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public Conversation getCurrentConversation()
    {

        Bean<Conversation> bean = (Bean<Conversation>)BeanManagerImpl.getManager().resolveByType(Conversation.class, new CurrentLiteral()).iterator().next();
        Conversation conversation = BeanManagerImpl.getManager().getInstance(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

   *
   * this method allows to start a conversation if no conversation is active
   */
  public Task startTask(String taskId, boolean beginConversation) {
    if(beginConversation) {
      Conversation conversation = conversationInstance.get();
      if(conversation.isTransient()) {
       conversation.begin();
      }
    }
    return startTask(taskId);
  }
View Full Code Here

                return;
            }

            WebBeansContext webBeansContext = WebBeansContext.getInstance();
            ConversationManager conversationManager = webBeansContext.getConversationManager();
            Conversation conversation = conversationManager.getConversationBeanReference();

            if (conversation.isTransient())
            {
                if (logger.isLoggable(Level.FINE))
                {
                    logger.log(Level.FINE, "Destroying the conversation context with cid : [{0}]", conversation.getId());
                }
                ContextFactory contextFactory = webBeansContext.getContextFactory();
                contextFactory.destroyConversationContext();
            }
            else
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.