org.apache.myfaces.orchestra.conversation
Class ConversationRequestParameterProvider

java.lang.Object
  extended by org.apache.myfaces.orchestra.conversation.ConversationRequestParameterProvider
All Implemented Interfaces:
RequestParameterProvider

public class ConversationRequestParameterProvider
extends Object
implements RequestParameterProvider

Adds the required fields (conversationContext) to the request parameters.

This ensures that every URL in the generated page contains the current conversation context id as a query parameter. When the request is submitted to the server this query parameter is then used to select the correct ConversationContext instance from the user session (ie the set of Conversation objects that are associated with this particular window).


Constructor Summary
ConversationRequestParameterProvider()
           
 
Method Summary
 String[] getFields()
          Return the names of fields this instance wants to add to the url.
 String getFieldValue(String field)
          Return the value for the given field (which should be one of the values returned by the getFields method).
static boolean isInSeparationMode()
          Returns true if URLs should be written out unmodified, false if they should have the conversation context id appended as a query parameter.
static void setInSeparationMode(boolean separationMode)
          Update a threadlocal flag indicating whether URLs written to the response page should have the special ConversationContext query parameter added to them or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversationRequestParameterProvider

public ConversationRequestParameterProvider()
Method Detail

setInSeparationMode

public static void setInSeparationMode(boolean separationMode)
Update a threadlocal flag indicating whether URLs written to the response page should have the special ConversationContext query parameter added to them or not.

Defaults to false (no separation), which means that urls ARE modified.

This can be called by a component before rendering its children in order to skip this url mangling. Any code that calls this method is responsible for restoring the original value at the appropriate time. This is very important, because this is a thread-local value that will be inherited by whatever request this pooled thread is reused for!


isInSeparationMode

public static boolean isInSeparationMode()
Returns true if URLs should be written out unmodified, false if they should have the conversation context id appended as a query parameter.


getFieldValue

public String getFieldValue(String field)
Description copied from interface: RequestParameterProvider
Return the value for the given field (which should be one of the values returned by the getFields method).

Specified by:
getFieldValue in interface RequestParameterProvider

getFields

public String[] getFields()
Description copied from interface: RequestParameterProvider
Return the names of fields this instance wants to add to the url. Each value in the returned array is then used as a parameter to the getFieldValue method.

Specified by:
getFields in interface RequestParameterProvider


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.