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
An implementation of
HttpConversationContext that 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, BusyConversationException or
NonexistentConversationException may be thrown late in the
request processing and any component invoking methods on ConversationScoped beans 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
ConstructorsConstructorDescriptionLazyHttpConversationContextImpl(String contextId, org.jboss.weld.bootstrap.api.ServiceRegistry services) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()voidactivateLazily(Consumer<jakarta.servlet.http.HttpServletRequest> transientConversationInitializationCallback) protected voidvoidbooleandestroy(jakarta.servlet.http.HttpSession session) protected voidinitialize(String cid) booleanMethods inherited from class org.jboss.weld.module.web.context.http.HttpConversationContextImpl
createRequestBeanStore, createSessionBeanStore, getNamingSchemePrefix, getRequestAttribute, getSessionAttribute, getSessionAttributeFromSession, getSessionAttributeNames, getSessionFromRequest, removeRequestAttribute, setRequestAttribute, setSessionAttributeMethods 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, setParameterNameMethods inherited from class org.jboss.weld.contexts.AbstractBoundContext
cleanup, clearAndSet, getAllContextualInstances, getBeanStore, setBeanStoreMethods inherited from class org.jboss.weld.contexts.AbstractManagedContext
isActive, isValid, removeState, setActiveMethods inherited from class org.jboss.weld.contexts.AbstractContext
destroy, destroy, get, get, getContextual, getId, getServiceRegistry, isMultithreadedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.enterprise.context.spi.AlterableContext
destroyMethods inherited from interface org.jboss.weld.context.BoundContext
associate, dissociateMethods inherited from interface jakarta.enterprise.context.spi.Context
get, get, getScope, isActiveMethods inherited from interface org.jboss.weld.context.ConversationContext
activate, generateConversationId, getConcurrentAccessTimeout, getConversation, getConversations, getCurrentConversation, getDefaultTimeout, getParameterName, invalidate, setConcurrentAccessTimeout, setDefaultTimeout, setParameterNameMethods inherited from interface org.jboss.weld.context.WeldAlterableContext
clearAndSet, getAllContextualInstances
-
Constructor Details
-
LazyHttpConversationContextImpl
public LazyHttpConversationContextImpl(String contextId, org.jboss.weld.bootstrap.api.ServiceRegistry services)
-
-
Method Details
-
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
- 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
-