...
When resolving a request URL to a resource, the list is walked and each plugin is in turn asked, whether it matches the request and can provide a resource mapping. Likewise when mapping resource paths to request URLs the list is walked and the plugin is asked whether it matches the path and can provide a mapped URL.
Interfaces
Code Block |
---|
| java |
---|
| java |
---|
title | ResourceResolutionPlugin.javajava |
---|
|
public interface ResourceResolutionPlugin {
static final String SERVICE = "ResourceResolutionPlugin";
/**
* Return a new resource resolution plugin instance configured
* from the given configuration. This ValueMap is created from the
* resource below /etc/map which instructs this plugin to be used.
*/
ResourceResolutionInstance newInstance(ValueMap configuration);
}
|
Code Block |
---|
| java |
---|
| java |
---|
title | ResourceResolutionInstance.javajava |
---|
|
public interface ResourceResolutionInstance {
/**
* Return redirect information with respect to the
* request and the path or null if this instance
* cannot handle the path.
*/
RedirectInfo resolve(ResourceResolver resolver, HttpServletRequest request, String path);
/**
* Return an URL string or null if this instance cannot
* map the path.
*/
String map(ResourceResolver resolver, HttpServletRequest request, String path);
}
|
Code Block |
---|
| java |
---|
| java |
---|
title | RedirectInfo.javajava |
---|
|
// this may also be a class ...
public interface RedirectInfo {
/**
* Returns the resource to which the path resolved. This must
* only return a non-null value if getRedirect() returns null.
*/
Resource getResource();
/**
* Returns the redirect target to which the path resolved. This
* must only return a non-null value if getResource() returns
* null.
*/
String getRedirect();
/**
* The HTTP status code to use for the redirect to the target
* given by getRedirect(). This should only be considered valid
* if getRedirect() returns a non-null value.
int getStatus();
}
|