protected void activateConversationContext(HttpServletRequest request) { HttpConversationContext conversationContext = httpConversationContext(); String cid = getConversationId(request, httpConversationContext()); log.debug(RESUMING_CONVERSATION, cid); /* * Don't try to reactivate the ConversationContext if we have already activated it for this request WELD-877 */ if (!isContextActivatedInRequest(request)) { setContextActivatedInRequest(request); conversationContext.activate(cid); if (cid == null) { // transient conversation beanManager .getAccessibleLenientObserverNotifier() .fireEvent(request, InitializedLiteral.CONVERSATION); } } else { /* * We may have previously been associated with a ConversationContext, but the reference to that context may have * been lost during a Servlet forward WELD-877 */ conversationContext.dissociate(request); conversationContext.associate(request); conversationContext.activate(cid); } }
private void flushCaches() { deploymentManager.getBeanResolver().clear(); deploymentManager.getAccessibleLenientObserverNotifier().clear(); deploymentManager.getGlobalStrictObserverNotifier().clear(); deploymentManager.getGlobalLenientObserverNotifier().clear(); deploymentManager.getDecoratorResolver().clear(); deploymentManager.getInterceptorResolver().clear(); deploymentManager.getNameBasedResolver().clear(); for (BeanDeployment beanDeployment : getBeanDeployments()) { BeanManagerImpl beanManager = beanDeployment.getBeanManager(); beanManager.getBeanResolver().clear(); beanManager.getAccessibleLenientObserverNotifier().clear(); beanManager.getDecoratorResolver().clear(); beanManager.getInterceptorResolver().clear(); beanManager.getNameBasedResolver().clear(); } }
protected void deactivateConversationContext(HttpServletRequest request) { ConversationContext conversationContext = httpConversationContext(); if (conversationContext.isActive()) { // Only deactivate the context if one is already active, otherwise we get Exceptions boolean isTransient = conversationContext.getCurrentConversation().isTransient(); if (log.isTraceEnabled()) { if (isTransient) { log.trace(CLEANING_UP_TRANSIENT_CONVERSATION); } else { log.trace(CLEANING_UP_CONVERSATION, conversationContext.getCurrentConversation().getId()); } } conversationContext.invalidate(); conversationContext.deactivate(); if (isTransient) { beanManager .getAccessibleLenientObserverNotifier() .fireEvent(request, DestroyedLiteral.CONVERSATION); } } }