Package org.jboss.weld.contexts
Class AbstractConversationContext<R,S>
java.lang.Object
org.jboss.weld.contexts.AbstractContext
org.jboss.weld.contexts.AbstractManagedContext
org.jboss.weld.contexts.AbstractBoundContext<R>
org.jboss.weld.contexts.AbstractConversationContext<R,S>
- All Implemented Interfaces:
jakarta.enterprise.context.spi.AlterableContext,jakarta.enterprise.context.spi.Context,org.jboss.weld.context.BoundContext<R>,org.jboss.weld.context.ConversationContext,org.jboss.weld.context.ManagedContext,org.jboss.weld.context.WeldAlterableContext
- Direct Known Subclasses:
BoundConversationContextImpl
public abstract class AbstractConversationContext<R,S>
extends AbstractBoundContext<R>
implements org.jboss.weld.context.ConversationContext
The base of the conversation context, which can use a variety of storage
forms
- Author:
- Pete Muir, Jozef Hartinger, George Sapountzis, Marko Luksa
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractConversationContext(String contextId, org.jboss.weld.bootstrap.api.ServiceRegistry services) -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()voidbooleanprotected voidassociateRequest(org.jboss.weld.context.ManagedConversation conversation) protected voidvoidconversationPromotedToLongRunning(ConversationImpl conversation) protected voidprotected abstract BoundBeanStorecreateRequestBeanStore(NamingScheme namingScheme, R request) protected abstract BoundBeanStorecreateSessionBeanStore(NamingScheme namingScheme, S session) voidbooleanprotected voiddestroyConversation(S session, String id, boolean fireEvents) booleandissociate(R request) longorg.jboss.weld.context.ManagedConversationprotected ConversationIdGeneratorCollection<org.jboss.weld.context.ManagedConversation>org.jboss.weld.context.ManagedConversationlongprotected abstract Stringprotected RGet the associated storeprotected abstract ObjectgetRequestAttribute(R request, String name) Retrieve an attribute value from the requestClass<? extends Annotation>getScope()protected abstract ObjectgetSessionAttribute(R request, String name, boolean create) Get an attribute value from the session.protected abstract ObjectgetSessionAttributeFromSession(S session, String name) Get an attribute value from the session.getSessionAttributeNames(S session) protected abstract SgetSessionFromRequest(R request, boolean create) protected voidinitialize(String cid) voidprotected booleanCheck if the context is currently associatedprotected abstract voidremoveRequestAttribute(R request, String name) Remove an attribute from the request.voidvoidsetConcurrentAccessTimeout(long timeout) voidsetDefaultTimeout(long timeout) voidsetParameterName(String cid) protected abstract voidsetRequestAttribute(R request, String name, Object value) Set an attribute in the request.protected abstract voidsetSessionAttribute(R request, String name, Object value, boolean create) Set an attribute in the session.Methods 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
checkContextInitialized, 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 jakarta.enterprise.context.spi.Context
get, get, isActiveMethods inherited from interface org.jboss.weld.context.WeldAlterableContext
clearAndSet, getAllContextualInstances
-
Field Details
-
CONVERSATIONS_ATTRIBUTE_NAME
-
DESTRUCTION_QUEUE_ATTRIBUTE_NAME
-
-
Constructor Details
-
AbstractConversationContext
public AbstractConversationContext(String contextId, org.jboss.weld.bootstrap.api.ServiceRegistry services)
-
-
Method Details
-
getParameterName
- Specified by:
getParameterNamein interfaceorg.jboss.weld.context.ConversationContext
-
setParameterName
- Specified by:
setParameterNamein interfaceorg.jboss.weld.context.ConversationContext
-
setConcurrentAccessTimeout
public void setConcurrentAccessTimeout(long timeout) - Specified by:
setConcurrentAccessTimeoutin interfaceorg.jboss.weld.context.ConversationContext
-
getConcurrentAccessTimeout
public long getConcurrentAccessTimeout()- Specified by:
getConcurrentAccessTimeoutin interfaceorg.jboss.weld.context.ConversationContext
-
setDefaultTimeout
public void setDefaultTimeout(long timeout) - Specified by:
setDefaultTimeoutin interfaceorg.jboss.weld.context.ConversationContext
-
getDefaultTimeout
public long getDefaultTimeout()- Specified by:
getDefaultTimeoutin interfaceorg.jboss.weld.context.ConversationContext
-
associate
- Specified by:
associatein interfaceorg.jboss.weld.context.BoundContext<R>
-
dissociate
- Specified by:
dissociatein interfaceorg.jboss.weld.context.BoundContext<R>- Overrides:
dissociatein classAbstractBoundContext<R>
-
copyConversationIdGeneratorAndConversationsToSession
protected void copyConversationIdGeneratorAndConversationsToSession() -
sessionCreated
public void sessionCreated() -
associateRequestWithNewConversation
protected void associateRequestWithNewConversation() -
associateRequest
protected void associateRequest(org.jboss.weld.context.ManagedConversation conversation) -
activate
public void activate()- Specified by:
activatein interfaceorg.jboss.weld.context.ConversationContext- Specified by:
activatein interfaceorg.jboss.weld.context.ManagedContext- Overrides:
activatein classAbstractBoundContext<R>
-
activate
- Specified by:
activatein interfaceorg.jboss.weld.context.ConversationContext
-
initialize
-
deactivate
public void deactivate()- Specified by:
deactivatein interfaceorg.jboss.weld.context.ManagedContext- Overrides:
deactivatein classAbstractBoundContext<R>
-
conversationPromotedToLongRunning
-
invalidate
public void invalidate()- Specified by:
invalidatein interfaceorg.jboss.weld.context.ConversationContext- Specified by:
invalidatein interfaceorg.jboss.weld.context.ManagedContext- Overrides:
invalidatein classAbstractManagedContext
-
destroy
-
destroyConversation
-
generateConversationId
- Specified by:
generateConversationIdin interfaceorg.jboss.weld.context.ConversationContext
-
getConversationIdGenerator
-
getConversation
- Specified by:
getConversationin interfaceorg.jboss.weld.context.ConversationContext
-
getConversations
- Specified by:
getConversationsin interfaceorg.jboss.weld.context.ConversationContext
-
getCurrentConversation
public org.jboss.weld.context.ManagedConversation getCurrentConversation()- Specified by:
getCurrentConversationin interfaceorg.jboss.weld.context.ConversationContext
-
getScope
- Specified by:
getScopein interfacejakarta.enterprise.context.spi.Context
-
setSessionAttribute
Set an attribute in the session.- Parameters:
request- the request to set the session attribute inname- the name of the attributevalue- the value of the attributecreate- if false, the attribute will only be set if the session already exists, otherwise it will always be set- Throws:
IllegalStateException- if create is true, and the session can't be created
-
getSessionAttribute
Get an attribute value from the session.- Parameters:
request- the request to get the session attribute fromname- the name of the attributecreate- if false, the attribute will only be retrieved if the session already exists, other wise it will always be retrieved- Returns:
- attribute
- Throws:
IllegalStateException- if create is true, and the session can't be created
-
getSessionAttributeFromSession
Get an attribute value from the session.- Parameters:
session- the session to get the session attribute fromname- the name of the attribute- Returns:
- attribute
- Throws:
IllegalStateException- if create is true, and the session can't be created
-
removeRequestAttribute
Remove an attribute from the request.- Parameters:
request- the request to remove the attribute fromname- the name of the attribute
-
setRequestAttribute
Set an attribute in the request.- Parameters:
request- the request to set the attribute fromname- the name of the attributevalue- the value of the attribute
-
getRequestAttribute
Retrieve an attribute value from the request- Parameters:
request- the request to get the attribute fromname- the name of the attribute to get- Returns:
- the value of the attribute
-
createRequestBeanStore
-
createSessionBeanStore
-
getSessionFromRequest
-
getNamingSchemePrefix
-
isAssociated
protected boolean isAssociated()Check if the context is currently associated- Returns:
- true if the context is associated
-
getRequest
Get the associated store- Returns:
- the request
-
getSessionAttributeNames
-