Class ResourceResolution
- java.lang.Object
-
- org.apache.sling.scripting.sightly.engine.ResourceResolution
-
public final class ResourceResolution extends java.lang.Object
Utility class which is used by the HTL engine & extensions to resolve resources.
-
-
Constructor Summary
Constructors Constructor Description ResourceResolution()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Resource
getResourceForRequest(ResourceResolver resolver, SlingHttpServletRequest request)
Resolves the resource accessed by arequest
.static Resource
getResourceFromSearchPath(Resource base, java.lang.String path)
Resolves a resource from the search path relative to thebase
resource by traversing thesling:resourceSuperType
chain.
-
-
-
Method Detail
-
getResourceFromSearchPath
public static Resource getResourceFromSearchPath(Resource base, java.lang.String path)
Resolves a resource from the search path relative to the
base
resource by traversing thesling:resourceSuperType
chain.Since this method will traverse the
sling:resourceSuperType
chain, theResourceResolver
used for resolving thebase
resource should be able to read the super type resources.- Parameters:
base
- the base resource from which to start the lookuppath
- the relative path to the resource; if the path is absolute theResource
identified by this path will be returned- Returns:
- the resource identified by the relative
path
ornull
if no resource was found - Throws:
java.lang.UnsupportedOperationException
- if the resource is not in the resource resolver's search pathjava.lang.IllegalStateException
- if the number of steps necessary to search for the resource on the resource superType chain has reached the maximum limit- See Also:
ResourceResolver.getSearchPath()
-
getResourceForRequest
public static Resource getResourceForRequest(ResourceResolver resolver, SlingHttpServletRequest request)
Resolves the resource accessed by a
request
. Since therequest
can use an anonymousResourceResolver
, the passedresolver
parameter should have read access rights to resources from the search path.- Parameters:
resolver
- aResourceResolver
that has read access rights to resources from the search pathrequest
- the request- Returns:
- the resource identified by the
request
ornull
if no resource was found
-
-