Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.jboss.weld.context;
  
  
  import  javax.servlet.http.HttpSession;
  

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 &#064B;und ConversationContext conversationContext;
 

Author(s):
Pete Muir
See also:
BoundConversationContext
HttpConversationContext
ConversationScoped
 
 public interface ConversationContext extends ManagedContext {

    
Cause any expired conversations to be ended, and therefore marked for destruction when deactivate is called.

Throws:
IllegalStateException if the context is unable to access the underlying data store
 
     void invalidate();

    
Activate the conversation context, using the id provided to attempt to restore a long-running conversation

Parameters:
cid if the cid is null, a transient conversation will be created, otherwise the conversation will be restored
Throws:
IllegalStateException if the context is unable to access the underlying data store
 
     void activate(String cid);

    
Activate the conversation context, starting a new transient conversation

Throws:
IllegalStateException if the context is unable to access the underlying data store
 
     void activate();

    
Set the name of the parameter used to propagate the conversation id

Parameters:
cid the name of the conversation id parameter
 
     void setParameterName(String cid);

    
Get the name of the parameter used to propagate the conversation id

Returns:
the name of the conversation id parameter
 
     String getParameterName();

    
Set the concurrent access timeout

Parameters:
timeout the timeout (in ms) for the concurrent access lock
 
     void setConcurrentAccessTimeout(long timeout);

    
Get the current concurrent access timeout

Returns:
the timeout (in ms) for the concurrent access lock
 
     long getConcurrentAccessTimeout();

    
Set the default inactivity timeout. This may be overridden on a per conversation basis using Conversation.setTimeout(long)

Parameters:
timeout the default inactivity timeout (in ms)
 
    void setDefaultTimeout(long timeout);

    
Get the default inactivity timeout. This may have been overridden on a per conversation basis.

Returns:
the default inactivity timeout (in ms)
    long getDefaultTimeout();

    
Get conversations currently known to the context. This will include any non transient conversations, as well as any conversations which were previously long running and have been made transient during this request.

Returns:
a collection containing the conversations
Throws:
IllegalStateException if the context is unable to access the underlying data store
Get the conversation with the given id.

Parameters:
id the id of the conversation to get
Returns:
the conversation, or null if no conversation is known
Throws:
IllegalStateException if the context is unable to access the underlying data store
Generate a new, unique, conversation id

Returns:
a new, unique conversation id
Throws:
IllegalStateException if the context is unable to access the underlying data store
    String generateConversationId();

    
Get a handle the current conversation (transient or otherwise).

Returns:
the current conversation
Throws:
IllegalStateException if the context is unable to access the underlying data store
New to GrepCode? Check out our FAQ X