public interface ConversationContext extends ManagedContext
The built in conversation context is associated with ConversationScoped
. It can be activated, invalidated and
deactivated. and provides various options for configuring conversation defaults.
Weld comes with two implementation of the conversation context. The HttpConversationContext
, in which conversations
are bound to the HttpSession
, can be injected:
@ Inject @ Http ConversationContext conversationContext;
Alternatively the BoundConversationContext
in which conversations are bound a BoundRequest
can be injected:
@ Inject @ Bound ConversationContext conversationContext;
BoundConversationContext
,
HttpConversationContext
,
ConversationScoped
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activate the conversation context, starting a new transient conversation
|
void |
activate(String cid)
Activate the conversation context, using the id provided to attempt to restore a long-running conversation
|
String |
generateConversationId()
Generate a new, unique, conversation id
|
long |
getConcurrentAccessTimeout()
Get the current concurrent access timeout
|
ManagedConversation |
getConversation(String id)
Get the conversation with the given id.
|
Collection<ManagedConversation> |
getConversations()
Get conversations currently known to the context.
|
ManagedConversation |
getCurrentConversation()
Get a handle the current conversation (transient or otherwise).
|
long |
getDefaultTimeout()
Get the default inactivity timeout.
|
String |
getParameterName()
Get the name of the parameter used to propagate the conversation id
|
void |
invalidate()
Cause any expired conversations to be ended, and therefore marked for destruction when deactivate is called.
|
void |
setConcurrentAccessTimeout(long timeout)
Set the concurrent access timeout
|
void |
setDefaultTimeout(long timeout)
Set the default inactivity timeout.
|
void |
setParameterName(String cid)
Set the name of the parameter used to propagate the conversation id
|
deactivate
clearAndSet, getAllContextualInstances
destroy
void invalidate()
invalidate
in interface ManagedContext
IllegalStateException
- if the context is unable to access the underlying data storevoid activate(String cid)
cid
- if the cid is null, a transient conversation will be created, otherwise the conversation will be restoredIllegalStateException
- if the context is unable to access the underlying data storevoid activate()
activate
in interface ManagedContext
IllegalStateException
- if the context is unable to access the underlying data storevoid setParameterName(String cid)
cid
- the name of the conversation id parameterString getParameterName()
void setConcurrentAccessTimeout(long timeout)
timeout
- the timeout (in ms) for the concurrent access locklong getConcurrentAccessTimeout()
void setDefaultTimeout(long timeout)
Conversation.setTimeout(long)
timeout
- the default inactivity timeout (in ms)long getDefaultTimeout()
Collection<ManagedConversation> getConversations()
IllegalStateException
- if the context is unable to access the underlying data storeManagedConversation getConversation(String id)
id
- the id of the conversation to getIllegalStateException
- if the context is unable to access the underlying data storeString generateConversationId()
IllegalStateException
- if the context is unable to access the underlying data storeManagedConversation getCurrentConversation()
IllegalStateException
- if the context is unable to access the underlying data storeCopyright © 2019 JBoss by Red Hat. All rights reserved.