public final class ResourceResolution extends Object
Constructor and Description |
---|
ResourceResolution() |
Modifier and Type | Method and Description |
---|---|
static Resource |
getResourceForRequest(ResourceResolver resolver,
SlingHttpServletRequest request)
Resolves the resource accessed by a
request . |
static Resource |
getResourceFromSearchPath(Resource base,
String path)
Resolves a resource from the search path relative to the
base resource by traversing the sling:resourceSuperType
chain. |
public static Resource getResourceFromSearchPath(Resource base, String path)
Resolves a resource from the search path relative to the base
resource by traversing the sling:resourceSuperType
chain.
Since this method will traverse the sling:resourceSuperType
chain, the ResourceResolver
used for resolving the
base
resource should be able to read the super type resources.
base
- the base resource from which to start the lookuppath
- the relative path to the resource; if the path is absolute the Resource
identified by this path will be
returnedpath
or null
if no resource was foundUnsupportedOperationException
- if the resource is not in the resource resolver's search pathIllegalStateException
- if the number of steps necessary to search for the resource on the resource
superType chain has reached the maximum limitResourceResolver.getSearchPath()
public static Resource getResourceForRequest(ResourceResolver resolver, SlingHttpServletRequest request)
Resolves the resource accessed by a request
. Since the request
can use an anonymous ResourceResolver
, the
passed resolver
parameter should have read access rights to resources from the search path.
resolver
- a ResourceResolver
that has read access rights to resources from the search pathrequest
- the requestrequest
or null
if no resource was foundCopyright © 2017 The Apache Software Foundation. All rights reserved.