Package org.jboss.weld.context

Examples of org.jboss.weld.context.ConversationContext


      else
      {
         cid = request.getParameter("cid");
      }

      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())
      {
View Full Code Here


   @Override
   public void detach()
   {
      super.detach();
      ConversationContext conversationContext = instance().select(HttpConversationContext.class).get();
      try
      {
         conversationContext.invalidate();
      }
      catch (Exception e)
      {
      }
      try
      {
         conversationContext.deactivate();
      }
      catch (Exception e)
      {
      }
   }
View Full Code Here

        return new HttpServletResponseWrapper(response) {
            @Override
            public void sendRedirect(String path) throws IOException {
                FacesContext context = FacesContext.getCurrentInstance();
                if (context != null) { // this is a JSF request
                    ConversationContext conversationContext = instance(contextId).select(HttpConversationContext.class).get();
                    if (conversationContext.isActive()) {
                        Conversation conversation = conversationContext.getCurrentConversation();
                        if (!conversation.isTransient()) {
                            path = new FacesUrlTransformer(path, context)
                                .toRedirectViewId()
                                .toActionUrl()
                                .appendConversationIdIfNecessary(conversationContext.getParameterName(), conversation.getId())
                                .encode();
                        }
                    }
                }
                super.sendRedirect(path);
View Full Code Here

    /*
    * description = "WELD-348"
    */
    @Test
    public void testCallToConversationWithContextNotActive() {
        ConversationContext conversationContext;
        try {
            conversationContext = Utils.getActiveContext(beanManager, ConversationContext.class);
        } catch (ContextNotActiveException e) {
            conversationContext = Utils.getReference(beanManager, HttpConversationContext.class);
        }
View Full Code Here

            } else {
                contextId = RegistrySingletonProvider.STATIC_INSTANCE;
            }
        }
        String actionUrl = super.getActionURL(facesContext, viewId);
        final ConversationContext ctx = getConversationContext(contextId);
        if (ctx.isActive() && !getSource().equals(Source.BOOKMARKABLE) && getConversationContext(contextId).isActive() && !ctx.getCurrentConversation().isTransient()) {
            return new FacesUrlTransformer(actionUrl, facesContext)
                .appendConversationIdIfNecessary(getConversationContext(contextId).getParameterName(), ctx.getCurrentConversation().getId())
                .getUrl();
        } else {
            return actionUrl;
        }
    }
View Full Code Here

            cid = page.getMetaData(SeamMetaData.CID);
        } else {
            cid = request.getParameter("cid");
        }

        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
View Full Code Here

    }

    @Override
    public void detach() {
        super.detach();
        ConversationContext conversationContext = instance().select(HttpConversationContext.class).get();
        try {
            conversationContext.invalidate();
        } catch (Exception e) {
        }
        try {
            conversationContext.deactivate();
        } catch (Exception e) {
        }
    }
View Full Code Here

        }
        return (Boolean) result;
    }

    protected void deactivateConversationContext(HttpServletRequest request) {
        ConversationContext conversationContext = httpConversationContext();
        if (conversationContext.isActive()) {
            // Only deactivate the context if one is already active, otherwise we get Exceptions
            if (conversationContext instanceof LazyHttpConversationContextImpl) {
                LazyHttpConversationContextImpl lazyConversationContext = (LazyHttpConversationContextImpl) conversationContext;
                if (!lazyConversationContext.isInitialized()) {
                    // if this lazy conversation has not been touched yet, just deactivate it
                    lazyConversationContext.deactivate();
                    return;
                }
            }
            boolean isTransient = conversationContext.getCurrentConversation().isTransient();
            if (ConversationLogger.LOG.isTraceEnabled()) {
                if (isTransient) {
                    ConversationLogger.LOG.cleaningUpTransientConversation();
                } else {
                    ConversationLogger.LOG.cleaningUpConversation(conversationContext.getCurrentConversation().getId());
                }
            }
            conversationContext.invalidate();
            conversationContext.deactivate();
            if (isTransient) {
                conversationDestroyedEvent.fire(request);
            }
        }
    }
View Full Code Here

        notifyConversationContext();
        ConversationLogger.LOG.promotedTransient(id);
    }

    private void notifyConversationContext() {
        ConversationContext context = getActiveConversationContext();
        if (context instanceof AbstractConversationContext) {
            AbstractConversationContext<?, ?> abstractConversationContext = (AbstractConversationContext<?, ?>) context;
            abstractConversationContext.conversationPromotedToLongRunning(this);
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.weld.context.ConversationContext

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.