public class PathInfo extends Object implements RequestPathInfo
RequestPathInfo
by parsing a URL
path. Note that this does not check for the existence of the resource and
finding the longest-matching path as the default Sling resource resolution
does, it only works by parsing the raw string.
The parsing structure looks like this:
/resource/path.selector.ext/suffix
. The rules are (following the
Sling convention):
Constructor and Description |
---|
PathInfo(ResourceResolver resolver,
String urlPath)
|
PathInfo(String urlPath)
Creates a
RequestPathInfo by parsing the path part of a URL. |
Modifier and Type | Method and Description |
---|---|
String |
getExtension()
Returns the extension from the URL or
null if the request
URL does not contain an extension. |
String |
getResourcePath()
Return the "resource path" part of the URL, what comes before selectors,
extension and suffix.
|
String[] |
getSelectors()
Returns the selectors decoded from the request URL as an array of
strings.
|
String |
getSelectorString()
Returns the selectors decoded from the request URL as string.
|
String |
getSuffix()
Returns the suffix part of the URL or
null if the request
URL does not contain a suffix. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSuffixResource
public PathInfo(String urlPath)
RequestPathInfo
by parsing the path part of a URL. This method does not support url path
suffixes containing dots (".").urlPath
- the path part of a URLpublic PathInfo(ResourceResolver resolver, String urlPath)
RequestPathInfo
object using the given ResourceResolver
and urlPath
. The
resolver is used to map the underlying resource and reliably disassemble the urlPath into its segments.resolver
- The resource resolver.urlPath
- The url path.public String getResourcePath()
RequestPathInfo
Resource.getPath()
.
Rather it is equal to the
resolution path metadata property
of the resource.getResourcePath
in interface RequestPathInfo
public String getSelectorString()
RequestPathInfo
null
if the request has no selectors.
Decomposition of the request URL is defined in the Decomposition of a Request URL above.
getSelectorString
in interface RequestPathInfo
RequestPathInfo.getSelectors()
public String[] getSelectors()
RequestPathInfo
selector 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.
getSelectors
in interface RequestPathInfo
RequestPathInfo.getSelectorString()
public String getExtension()
RequestPathInfo
null
if the request
URL does not contain an extension.
Decomposition of the request URL is defined in the Decomposition of a Request URL above.
getExtension
in interface RequestPathInfo
public String getSuffix()
RequestPathInfo
null
if the request
URL does not contain a suffix.
Decomposition of the request URL is defined in the Decomposition of a Request URL above.
getSuffix
in interface RequestPathInfo
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"