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:
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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.
If the string neither contains a comma nor an equals sign, the
string is assumed to be a resource type. |
Modifier and Type | Method and Description |
---|---|
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)
|
void |
setForceResourceType(String resourceType)
|
void |
setReplaceSelectors(String replaceSelectors)
|
void |
setReplaceSuffix(String replaceSuffix)
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
public static final String OPT_FORCE_RESOURCE_TYPE
Resource
.public static final String OPT_REPLACE_SELECTORS
RequestPathInfo
selectors by the value
provided by this option. If this value contains an empty string, all
original selectors are removed.public static final String OPT_ADD_SELECTORS
RequestPathInfo
selectors.public static final String OPT_REPLACE_SUFFIX
RequestPathInfo
suffix by the value
provided by this optionpublic RequestDispatcherOptions()
public RequestDispatcherOptions(String options)
options
string as follows:
null
no options are set.RequestDispatcherOptions
object is created with the
OPT_FORCE_RESOURCE_TYPE
field set to the
string.RequestDispatcherOptions
object is created
from the name value pair list.options
- The options to set.public void setForceResourceType(String resourceType)
resourceType
- the resource typepublic String getForceResourceType()
OPT_FORCE_RESOURCE_TYPE
option or null
if not set.public void setAddSelectors(String additionalSelectors)
additionalSelectors
- The add selectorspublic String getAddSelectors()
OPT_ADD_SELECTORS
option or null
if
not set.public void setReplaceSelectors(String replaceSelectors)
OPT_REPLACE_SELECTORS
option to the given
replaceSelectors
if not null
.
If this value contains an empty string, all
original selectors are removed.replaceSelectors
- The replace selectors.public String getReplaceSelectors()
OPT_REPLACE_SELECTORS
option or null
if not set.public void setReplaceSuffix(String replaceSuffix)
replaceSuffix
- The replace suffixpublic String getReplaceSuffix()
OPT_REPLACE_SUFFIX
option or null
if
not set.Copyright © 2017 The Apache Software Foundation. All rights reserved.