Class SlingRequestPathInfo
java.lang.Object
org.apache.sling.engine.impl.request.SlingRequestPathInfo
- All Implemented Interfaces:
RequestPathInfo
Sling request URI parser that provides SlingRequestPathInfo for the
current request, based on the path of the Resource. The values provided by
this depend on the Resource.getPath() value, as the ResourceResolver might
use all or only part of the request URI path to locate the resource (see also
SLING-60 ). What we're after is the remainder of the path, the part that was
not used to locate the Resource, and we split that part in different
subparts: selectors, extension and suffix.
see SlingRequestPathInfoTest for a number of examples.
-
Constructor Summary
ConstructorDescriptionBreak requestPath as required by SlingRequestPathInfo. -
Method Summary
Modifier and TypeMethodDescriptionReturns the extension from the URL ornull
if the request URL does not contain an extension.Return the "resource path" part of the URL, what comes before selectors, extension and suffix.String[]
Returns the selectors decoded from the request URL as an array of strings.Returns the selectors decoded from the request URL as string.Returns the suffix part of the URL ornull
if the request URL does not contain a suffix.Returns the resource addressed by the suffix or null if the request does not have a suffix or the suffix does not address an accessible resource.merge
(RequestDispatcherOptions options) merge
(RequestPathInfo baseInfo) toString()
-
Constructor Details
-
SlingRequestPathInfo
Break requestPath as required by SlingRequestPathInfo.- Parameters:
r
- the resource
-
-
Method Details
-
merge
-
merge
-
toString
-
getExtension
Description copied from interface:RequestPathInfo
Returns the extension from the URL ornull
if the request URL does not contain an extension.Decomposition of the request URL is defined in the Decomposition of a Request URL above.
- Specified by:
getExtension
in interfaceRequestPathInfo
- Returns:
- The extension from the request URL.
-
getSelectors
Description copied from interface:RequestPathInfo
Returns the selectors decoded from the request URL as an array of strings. This array is derived from theselector string
by splitting the string on dots. Returns an empty array if the request has no selectors.Decomposition of the request URL is defined in the Decomposition of a Request URL above.
- Specified by:
getSelectors
in interfaceRequestPathInfo
- Returns:
- An array of selectors
- See Also:
-
getSelectorString
Description copied from interface:RequestPathInfo
Returns the selectors decoded from the request URL as string. Returnsnull
if the request has no selectors.Decomposition of the request URL is defined in the Decomposition of a Request URL above.
- Specified by:
getSelectorString
in interfaceRequestPathInfo
- Returns:
- The selector string or
null
- See Also:
-
getSuffix
Description copied from interface:RequestPathInfo
Returns the suffix part of the URL ornull
if the request URL does not contain a suffix.Decomposition of the request URL is defined in the Decomposition of a Request URL above.
- Specified by:
getSuffix
in interfaceRequestPathInfo
- Returns:
- The suffix part of the request URL.
-
getSuffixResource
Description copied from interface:RequestPathInfo
Returns the resource addressed by the suffix or null if the request does not have a suffix or the suffix does not address an accessible resource.The suffix is expected to be the absolute path to the resource suitable as an argument to the
ResourceResolver.getResource(String)
method.- Specified by:
getSuffixResource
in interfaceRequestPathInfo
- Returns:
- The suffix resource or
null
.
-
getResourcePath
Description copied from interface:RequestPathInfo
Return the "resource path" part of the URL, what comes before selectors, extension and suffix. This string is part of the request URL and need not be equal to theResource.getPath()
. Rather it is equal to theresolution path metadata property
of the resource.- Specified by:
getResourcePath
in interfaceRequestPathInfo
- Returns:
- The resource path
-