Provide a hook to decorate or override the way that Facelets loads template files. A default implementation must be provided that satisfies the requirements for loading templates as in Pre-JSF 2.0 Facelets.
If a <context-param>
with the param name equal to the value of {@link #FACELETS_RESOURCE_RESOLVER_PARAM_NAME}exists, the runtime must interpret its value as a fully qualified classname of a java class that extends ResourceResolver
and has a zero argument public constructor or a one argument public constructor where the type of the argument is ResourceResolver
. If this param is set and its value does not conform to those requirements, the runtime must log a message and continue. If it does conform to these requirements and has a one-argument constructor, the default ResourceResolver
must be passed to the constructor. If it has a zero argument constructor it is invoked directly. In either case, the new ResourceResolver
replaces the old one.
ResourceResolver
defines the service API which may be used to resolve {@link Resource} objects. The resource resolver is available tothe request processing servlet through the {@link org.apache.sling.api.SlingHttpServletRequest#getResourceResolver()}method. A resource resolver can also be created through the {@link ResourceResolverFactory}. The ResourceResolver
is also an {@link Adaptable} to getadapters to other types. A JCR based resource resolver might support adapting to the JCR Session used by the resolver to access the JCR Repository.
A ResourceResolver
is generally not thread safe! As a consequence, an application which uses the resolver, its returned resources and/or objects resulting from adapting either the resolver or a resource, must provide proper synchronization to ensure no more than one thread concurrently operates against a single resolver, resource or resulting objects.
Accessing Resources
This interface defines two kinds of methods to access resources: The resolve
methods and the getResource
methods. The difference lies in the algorithm applied to find the requested resource and in the behavior in case a resource cannot be found:
Method Kind | Access Algorithm | Missing Resource |
---|---|---|
resolve | Path is always assumed to be absolute. Uses elaborate resource resolution algorithm. This kind of method is intended to resolve request URLs to resources. | Returns {@link NonExistingResource} |
getResource | Directly access resources with absolute path. For relative paths, the {@link #getSearchPath() search path} is applied. This method is intended tobe used by request processing scripts to access further resources as required. | Returns null |
Lifecycle
A Resource Resolver has a life cycle which begins with the creation of the Resource Resolver using any of the factory methods and ends with calling the {@link #close()} method. It is very important to call the {@link #close()}method once the resource resolver is not used any more to ensure any system resources are properly cleaned up.
To check whether a Resource Resolver can still be used, the {@link #isLive()}method can be called.
Resource Resolver Attributes
The authentication info properties provided to the {@link ResourceResolverFactory#getResourceResolver(Map)}, {@link ResourceResolverFactory#getAdministrativeResourceResolver(Map)}, or {@link #clone(Map)} are available through the {@link #getAttributeNames()}and {@link #getAttribute(String)} methods with the exception of securitysensitive properties like {@link ResourceResolverFactory#PASSWORD} which isnot exposed.
Provides mechanisms for resolving an incoming request to an actual {@link org.springframework.core.io.Resource} and for obtaining the publicURL path that clients should use when requesting the resource. @author Jeremy Grelle @author Rossen Stoyanchev @author Sam Brannen @since 4.1 @see org.springframework.web.servlet.resource.ResourceResolverChain
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|