org.apache.sling.api.request
Class RequestDispatcherOptions

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<String,String>
          extended by org.apache.sling.api.request.RequestDispatcherOptions
All Implemented Interfaces:
Serializable, Cloneable, Map<String,String>

public class RequestDispatcherOptions
extends HashMap<String,String>

RequestDispatcherOptions are used in the SlingHttpServletRequest.getRequestDispatcher(org.apache.sling.api.resource.Resource, RequestDispatcherOptions) method, to give more control on some aspects of the include/forward mechanism. Typical use cases include:

This class currently only inherits from Map, and defines some constants for well-known options.

See Also:
Serialized Form

Field Summary
static String OPT_ADD_SELECTORS
          When dispatching, add the value provided by this option to the RequestPathInfo selectors.
static String OPT_FORCE_RESOURCE_TYPE
          When dispatching, use the value provided by this option as the resource type, instead of the one defined by the Resource.
static String OPT_REPLACE_SELECTORS
          When dispatching, replace RequestPathInfo selectors by the value provided by this option.
static String OPT_REPLACE_SUFFIX
          When dispatching, replace the RequestPathInfo suffix by the value provided by this option
 
Constructor Summary
RequestDispatcherOptions()
          Creates an instance with no options set.
RequestDispatcherOptions(String options)
          Creates a new instances setting options by parsing the given options string as follows: If the string is empty or null no options are set.
 
Method Summary
 String getAddSelectors()
          Returns the OPT_ADD_SELECTORS option or null if not set.
 String getForceResourceType()
          Returns the OPT_FORCE_RESOURCE_TYPE option or null if not set.
 String getReplaceSelectors()
          Returns the OPT_REPLACE_SELECTORS option or null if not set.
 String getReplaceSuffix()
          Returns the OPT_REPLACE_SUFFIX option or null if not set.
 void setAddSelectors(String additionalSelectors)
          Sets the OPT_ADD_SELECTORS option to the given additionalSelectors if not null.
 void setForceResourceType(String resourceType)
          Sets the OPT_FORCE_RESOURCE_TYPE option to the given resourceType if not null.
 void setReplaceSelectors(String replaceSelectors)
          Sets the OPT_REPLACE_SELECTORS option to the given replaceSelectors if not null.
 void setReplaceSuffix(String replaceSuffix)
          Sets the OPT_REPLACE_SUFFIX option to the given replaceSuffix if not null.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

OPT_FORCE_RESOURCE_TYPE

public static final String OPT_FORCE_RESOURCE_TYPE
When dispatching, use the value provided by this option as the resource type, instead of the one defined by the Resource.

See Also:
Constant Field Values

OPT_REPLACE_SELECTORS

public static final String OPT_REPLACE_SELECTORS
When dispatching, replace RequestPathInfo selectors by the value provided by this option. If this value contains an empty string, all original selectors are removed.

See Also:
Constant Field Values

OPT_ADD_SELECTORS

public static final String OPT_ADD_SELECTORS
When dispatching, add the value provided by this option to the RequestPathInfo selectors.

See Also:
Constant Field Values

OPT_REPLACE_SUFFIX

public static final String OPT_REPLACE_SUFFIX
When dispatching, replace the RequestPathInfo suffix by the value provided by this option

See Also:
Constant Field Values
Constructor Detail

RequestDispatcherOptions

public RequestDispatcherOptions()
Creates an instance with no options set.


RequestDispatcherOptions

public RequestDispatcherOptions(String options)
Creates a new instances setting options by parsing the given options string as follows:

Parameters:
options - The options to set.
Method Detail

setForceResourceType

public void setForceResourceType(String resourceType)
Sets the OPT_FORCE_RESOURCE_TYPE option to the given resourceType if not null.


getForceResourceType

public String getForceResourceType()
Returns the OPT_FORCE_RESOURCE_TYPE option or null if not set.


setAddSelectors

public void setAddSelectors(String additionalSelectors)
Sets the OPT_ADD_SELECTORS option to the given additionalSelectors if not null.


getAddSelectors

public String getAddSelectors()
Returns the OPT_ADD_SELECTORS option or null if not set.


setReplaceSelectors

public void setReplaceSelectors(String replaceSelectors)
Sets the OPT_REPLACE_SELECTORS option to the given replaceSelectors if not null. If this value contains an empty string, all original selectors are removed.


getReplaceSelectors

public String getReplaceSelectors()
Returns the OPT_REPLACE_SELECTORS option or null if not set.


setReplaceSuffix

public void setReplaceSuffix(String replaceSuffix)
Sets the OPT_REPLACE_SUFFIX option to the given replaceSuffix if not null.


getReplaceSuffix

public String getReplaceSuffix()
Returns the OPT_REPLACE_SUFFIX option or null if not set.



Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.