public class LazyHttpConversationContextImpl extends HttpConversationContextImpl
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.CONVERSATIONS_ATTRIBUTE_NAME| Constructor and Description |
|---|
LazyHttpConversationContextImpl(String contextId,
BeanIdentifierIndex beanIdentifierIndex) |
| Modifier and Type | Method and Description |
|---|---|
void |
activate()
Activate the Context.
|
void |
activate(Consumer<HttpServletRequest> initializationCallback) |
void |
deactivate()
Deactivate the Context, destroying any instances if the context is invalid.
|
boolean |
destroy(HttpSession session)
If the context is not currently associated with a
HttpServletRequest, then the context will be associated with
the specified HttpSession (for this thread), activated, destroyed, and then deactivated. |
protected void |
checkContextInitialized()
Allows contexts that are initialized lazily to plug in additional logic.
|
protected void |
initialize(String cid) |
boolean |
isInitialized() |
createRequestBeanStore, createSessionBeanStore, getNamingSchemePrefix, getRequestAttribute, getSessionAttribute, getSessionAttributeFromSession, getSessionFromRequest, removeRequestAttribute, setRequestAttribute, setSessionAttributeactivate, associate, associateRequest, associateRequestWithNewConversation, conversationPromotedToLongRunning, copyConversationIdGeneratorAndConversationsToSession, destroyConversation, dissociate, generateConversationId, getConcurrentAccessTimeout, getConversation, getConversationIdGenerator, getConversations, getCurrentConversation, getDefaultTimeout, getParameterName, getRequest, getScope, invalidate, isAssociated, sessionCreated, setConcurrentAccessTimeout, setDefaultTimeout, setParameterNamecleanup, getBeanStore, setBeanStoreisActive, isValid, removeState, setActivedestroy, get, get, getContextual, getId, getServiceRegistryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitassociate, dissociateactivate, generateConversationId, getConcurrentAccessTimeout, getConversation, getConversations, getCurrentConversation, getDefaultTimeout, getParameterName, invalidate, setConcurrentAccessTimeout, setDefaultTimeout, setParameterNamepublic LazyHttpConversationContextImpl(String contextId, BeanIdentifierIndex beanIdentifierIndex)
public void activate(Consumer<HttpServletRequest> initializationCallback)
initializationCallback - This callback will be executed during initializationpublic void activate()
ManagedContextactivate in interface ConversationContextactivate in interface ManagedContextactivate in class AbstractConversationContext<HttpServletRequest,HttpSession>public boolean isInitialized()
protected void initialize(String cid)
initialize in class AbstractConversationContext<HttpServletRequest,HttpSession>public void deactivate()
ManagedContextdeactivate in interface ManagedContextdeactivate in class AbstractConversationContext<HttpServletRequest,HttpSession>public boolean destroy(HttpSession session)
HttpConversationContext
If the context is not currently associated with a HttpServletRequest, then the context will be associated with
the specified HttpSession (for this thread), activated, destroyed, and then deactivated. Any conversations
associated with the context will also be destroyed.
If the context is already associated with a HttpServletRequest then this call will detach the context from the
underlying Http Session, and mark the context for destruction when the request is destroyed.
This will cause any transient conversations, and any long running conversations associated with the session, to be destroyed.
destroy in interface AlterableContextdestroy in interface HttpConversationContextdestroy in class AbstractConversationContext<HttpServletRequest,HttpSession>session - the HttpSession in which to store the bean instancesprotected void checkContextInitialized()
AbstractContextcheckContextInitialized in class AbstractContextCopyright © 2015. All Rights Reserved.