Class LazyHttpConversationContextImpl
- java.lang.Object
-
- org.jboss.weld.contexts.AbstractContext
-
- org.jboss.weld.contexts.AbstractManagedContext
-
- org.jboss.weld.contexts.AbstractBoundContext<R>
-
- org.jboss.weld.contexts.AbstractConversationContext<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpSession>
-
- org.jboss.weld.module.web.context.http.HttpConversationContextImpl
-
- org.jboss.weld.module.web.context.http.LazyHttpConversationContextImpl
-
- All Implemented Interfaces:
jakarta.enterprise.context.spi.AlterableContext,jakarta.enterprise.context.spi.Context,org.jboss.weld.context.BoundContext<jakarta.servlet.http.HttpServletRequest>,org.jboss.weld.context.ConversationContext,org.jboss.weld.context.http.HttpConversationContext,org.jboss.weld.context.ManagedContext,org.jboss.weld.context.WeldAlterableContext
public class LazyHttpConversationContextImpl extends HttpConversationContextImpl
An implementation ofHttpConversationContextthat is capable of lazy initialization. By default, the context is associated with a request and the active flag is set to true in the beginning of the request processing but the context is not initialized (cid not read and the state not restored) until the conversation context is first accessed. As a result,BusyConversationExceptionorNonexistentConversationExceptionmay be thrown late in the request processing and any component invoking methods onConversationScopedbeans should be ready to catch these exceptions. Lazy initialization is mostly a workaround for https://issues.jboss.org/browse/CDI-411.- Author:
- Jozef Hartinger
-
-
Field Summary
-
Fields inherited from class org.jboss.weld.contexts.AbstractConversationContext
CONVERSATIONS_ATTRIBUTE_NAME, DESTRUCTION_QUEUE_ATTRIBUTE_NAME
-
-
Constructor Summary
Constructors Constructor Description LazyHttpConversationContextImpl(String contextId, org.jboss.weld.bootstrap.api.ServiceRegistry services)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()voidactivateLazily(Consumer<jakarta.servlet.http.HttpServletRequest> transientConversationInitializationCallback)protected voidcheckContextInitialized()voiddeactivate()booleandestroy(jakarta.servlet.http.HttpSession session)protected voidinitialize(String cid)booleanisInitialized()-
Methods inherited from class org.jboss.weld.module.web.context.http.HttpConversationContextImpl
createRequestBeanStore, createSessionBeanStore, getNamingSchemePrefix, getRequestAttribute, getSessionAttribute, getSessionAttributeFromSession, getSessionAttributeNames, getSessionFromRequest, removeRequestAttribute, setRequestAttribute, setSessionAttribute
-
Methods inherited from class org.jboss.weld.contexts.AbstractConversationContext
activate, associate, associateRequest, associateRequestWithNewConversation, conversationPromotedToLongRunning, copyConversationIdGeneratorAndConversationsToSession, destroyConversation, dissociate, generateConversationId, getConcurrentAccessTimeout, getConversation, getConversationIdGenerator, getConversations, getCurrentConversation, getDefaultTimeout, getParameterName, getRequest, getScope, invalidate, isAssociated, sessionCreated, setConcurrentAccessTimeout, setDefaultTimeout, setParameterName
-
Methods inherited from class org.jboss.weld.contexts.AbstractBoundContext
cleanup, clearAndSet, getAllContextualInstances, getBeanStore, setBeanStore
-
Methods inherited from class org.jboss.weld.contexts.AbstractManagedContext
isActive, isValid, removeState, setActive
-
Methods inherited from class org.jboss.weld.contexts.AbstractContext
destroy, destroy, get, get, getContextual, getId, getServiceRegistry, isMultithreaded
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.enterprise.context.spi.Context
get, get, getScope, isActive
-
Methods inherited from interface org.jboss.weld.context.ConversationContext
activate, generateConversationId, getConcurrentAccessTimeout, getConversation, getConversations, getCurrentConversation, getDefaultTimeout, getParameterName, invalidate, setConcurrentAccessTimeout, setDefaultTimeout, setParameterName
-
-
-
-
Constructor Detail
-
LazyHttpConversationContextImpl
public LazyHttpConversationContextImpl(String contextId, org.jboss.weld.bootstrap.api.ServiceRegistry services)
-
-
Method Detail
-
activateLazily
public void activateLazily(Consumer<jakarta.servlet.http.HttpServletRequest> transientConversationInitializationCallback)
- Parameters:
transientConversationInitializationCallback- This callback will be executed during initialization
-
activate
public void activate()
- Specified by:
activatein interfaceorg.jboss.weld.context.ConversationContext- Specified by:
activatein interfaceorg.jboss.weld.context.ManagedContext- Overrides:
activatein classAbstractConversationContext<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpSession>
-
isInitialized
public boolean isInitialized()
-
initialize
protected void initialize(String cid)
- Overrides:
initializein classAbstractConversationContext<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpSession>
-
deactivate
public void deactivate()
- Specified by:
deactivatein interfaceorg.jboss.weld.context.ManagedContext- Overrides:
deactivatein classAbstractConversationContext<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpSession>
-
destroy
public boolean destroy(jakarta.servlet.http.HttpSession session)
- Specified by:
destroyin interfaceorg.jboss.weld.context.http.HttpConversationContext- Overrides:
destroyin classAbstractConversationContext<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpSession>
-
checkContextInitialized
protected void checkContextInitialized()
- Overrides:
checkContextInitializedin classAbstractContext
-
-