com.google.code.rees.scope.struts2
Class ConversationInterceptor

java.lang.Object
  extended by com.google.code.rees.scope.struts2.ConversationInterceptor
All Implemented Interfaces:
com.opensymphony.xwork2.interceptor.Interceptor, Serializable

public class ConversationInterceptor
extends Object
implements com.opensymphony.xwork2.interceptor.Interceptor

This interceptor uses an InjectionConversationProcessor to process conversation states and scopes.

Author:
rees.byars
See Also:
Serialized Form

Field Summary
protected  HttpConversationContextManagerProvider contextManagerProvider
           
static String CONVERSATION_EXCEPTION_ID_STACK_KEY
          In the case of an invalid id result, this key can be used to retrieve the offending conversation ID from the ValueStack.
static String CONVERSATION_EXCEPTION_KEY
          This key can be used in a message resource bundle to specify a message in the case of a an unexpected error occurring during conversation processing and also to map results as this will be the result value.
static String CONVERSATION_EXCEPTION_NAME_STACK_KEY
          In the case of an invalid id result, this key can be used to retrieve the offending conversation's name from the ValueStack.
static String CONVERSATION_ID_EXCEPTION_KEY
          This key can be used in a message resource bundle to specify a message in the case of a user submitting a request with an invalid conversation ID (i.e.
protected static Pattern ID_PARAM_PATTERN
           
protected static String ID_PARAM_REGEX
           
protected  ConversationProcessor processor
           
protected  ScopeContainer scopeContainer
           
 
Constructor Summary
ConversationInterceptor()
           
 
Method Summary
protected  void cleanupParamIds(Map<String,Object> parameters)
          removes the conversation ids from the parameter map so that they are excluded from further parameter processing
 void destroy()
          
protected  void handleConversationErrorAware(com.opensymphony.xwork2.ActionProxy proxy, String errorMessage)
          This provides extra functionality over placing on stack in that it allows for easily propagating the error through a redirect using a static result param:
protected  String handleIdException(com.opensymphony.xwork2.ActionInvocation invocation, ConversationIdException cie)
          Handles logging and UI messages for ConversationIdExceptions
protected  String handleUnexpectedException(com.opensymphony.xwork2.ActionInvocation invocation, ConversationException ce)
          Handles logging and UI messages for ConversationExceptions
 void init()
          
 String intercept(com.opensymphony.xwork2.ActionInvocation invocation)
          
 void setScopeContainerProvider(ScopeContainerProvider scopeContainerProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONVERSATION_ID_EXCEPTION_KEY

public static final String CONVERSATION_ID_EXCEPTION_KEY
This key can be used in a message resource bundle to specify a message in the case of a user submitting a request with an invalid conversation ID (i.e. the conversation has already ended or expired) and also to map results as this will be the result value

See Also:
Constant Field Values

CONVERSATION_EXCEPTION_KEY

public static final String CONVERSATION_EXCEPTION_KEY
This key can be used in a message resource bundle to specify a message in the case of a an unexpected error occurring during conversation processing and also to map results as this will be the result value.

Of course, we don't expect that this will happen ;)

See Also:
Constant Field Values

CONVERSATION_EXCEPTION_NAME_STACK_KEY

public static final String CONVERSATION_EXCEPTION_NAME_STACK_KEY
In the case of an invalid id result, this key can be used to retrieve the offending conversation's name from the ValueStack. This value can then be referenced in a message with the expression ${conversation.name}

See Also:
Constant Field Values

CONVERSATION_EXCEPTION_ID_STACK_KEY

public static final String CONVERSATION_EXCEPTION_ID_STACK_KEY
In the case of an invalid id result, this key can be used to retrieve the offending conversation ID from the ValueStack. This value can then be referenced in a message with the expression ${conversation.id}

See Also:
Constant Field Values

ID_PARAM_REGEX

protected static final String ID_PARAM_REGEX
See Also:
Constant Field Values

ID_PARAM_PATTERN

protected static final Pattern ID_PARAM_PATTERN

contextManagerProvider

protected HttpConversationContextManagerProvider contextManagerProvider

processor

protected ConversationProcessor processor

scopeContainer

protected ScopeContainer scopeContainer
Constructor Detail

ConversationInterceptor

public ConversationInterceptor()
Method Detail

setScopeContainerProvider

public void setScopeContainerProvider(ScopeContainerProvider scopeContainerProvider)

destroy

public void destroy()

Specified by:
destroy in interface com.opensymphony.xwork2.interceptor.Interceptor

init

public void init()

Specified by:
init in interface com.opensymphony.xwork2.interceptor.Interceptor

intercept

public String intercept(com.opensymphony.xwork2.ActionInvocation invocation)
                 throws Exception

Specified by:
intercept in interface com.opensymphony.xwork2.interceptor.Interceptor
Throws:
Exception

cleanupParamIds

protected void cleanupParamIds(Map<String,Object> parameters)
removes the conversation ids from the parameter map so that they are excluded from further parameter processing

Parameters:
parameters - a map of the request parameters

handleIdException

protected String handleIdException(com.opensymphony.xwork2.ActionInvocation invocation,
                                   ConversationIdException cie)
Handles logging and UI messages for ConversationIdExceptions

Parameters:
invocation -
cie -
Returns:

handleUnexpectedException

protected String handleUnexpectedException(com.opensymphony.xwork2.ActionInvocation invocation,
                                           ConversationException ce)
Handles logging and UI messages for ConversationExceptions

Parameters:
invocation -
ce -
Returns:

handleConversationErrorAware

protected void handleConversationErrorAware(com.opensymphony.xwork2.ActionProxy proxy,
                                            String errorMessage)
This provides extra functionality over placing on stack in that it allows for easily propagating the error through a redirect using a static result param:

<param name="conversationError">${conversationError}</param>



Copyright © 2012-2013. All Rights Reserved.