Package org.exoplatform.resolver
Class ResourceResolver
java.lang.Object
org.exoplatform.resolver.ResourceResolver
- Direct Known Subclasses:
ApplicationResourceResolver,ClasspathResourceResolver,FileResourceResolver,MockResourceResolver,PortletResourceResolver,ServletResourceResolver
This abstract class provide an abstract way to retrieve different resources in different contexts (war, jar....)
For example, to retrieve resource from an portlet, we implement
In gatein, we have caching machanism which use
as key to determine cached resource, ResourceKey is generated by ResourceResolver.createResourceKey method
By default, createResourceKey method return difference ResourceKey
if we call that method on difference ResourceResolver instances (even with the same resource url)
To make our caching machanism work properly,please make sure you use the same ResourceResolver
or override the createResourceKey method of abstract class ResourceResolver
and return the same ResourceKey for the same resource url
Created by The eXo Platform SAS Mar 15, 2006
For example, to retrieve resource from an portlet, we implement
PortletResourceResolver In gatein, we have caching machanism which use
ResourceKey as key to determine cached resource, ResourceKey is generated by ResourceResolver.createResourceKey method
By default, createResourceKey method return difference ResourceKey
if we call that method on difference ResourceResolver instances (even with the same resource url)
To make our caching machanism work properly,please make sure you use the same ResourceResolver
or override the createResourceKey method of abstract class ResourceResolver
and return the same ResourceKey for the same resource url
Created by The eXo Platform SAS Mar 15, 2006
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateResourceId(String url) Return resource idcreateResourceKey(String url) ReturnResourceKeyobject
Default implementation will return difference ResourceKey instance
if we call that method on difference ResourceResolver instances (even with the same resource url)
If you create new ResourceResolver each time you need access to a resource, please overidde this method
and return the same ResourceKey for the same urlabstract InputStreamgetInputStream(String url) Return InputStream object to resourceabstract List<InputStream> getInputStreams(String url) Return List of InputStream object to resourcegetRealPath(String url) abstract URLgetResource(String url) Return URL object to resourcebyte[]Return resource as array of bytesgetResources(String url) Return List of URL object to resourceabstract StringgetWebAccessPath(String url) abstract booleanisModified(String url, long lastAccess) Return if resource has been modified since specific timebooleanisResolvable(String url) Return if this can resolve resource with specific urlprotected StringremoveScheme(String url)
-
Constructor Details
-
ResourceResolver
public ResourceResolver()
-
-
Method Details
-
getResource
Return URL object to resource- Parameters:
url- - String path (specific to certain context) to resource- Throws:
Exception
-
getInputStream
Return InputStream object to resource- Parameters:
url- - String path (specific to certain context) to resource- Throws:
Exception
-
getResources
Return List of URL object to resource- Parameters:
url- - String path (specific to certain context) to resource- Throws:
Exception
-
getInputStreams
Return List of InputStream object to resource- Parameters:
url- - String path (specific to certain context) to resource- Throws:
Exception
-
getWebAccessPath
-
getResourceScheme
-
getRealPath
-
createResourceKey
ReturnResourceKeyobject
Default implementation will return difference ResourceKey instance
if we call that method on difference ResourceResolver instances (even with the same resource url)
If you create new ResourceResolver each time you need access to a resource, please overidde this method
and return the same ResourceKey for the same url- Parameters:
url- - String path (specific to certain context) to resource
-
createResourceId
Return resource id- Parameters:
url- - String path (specific to certain context) to resource
-
isResolvable
Return if this can resolve resource with specific url- Parameters:
url- String path to resource
-
getResourceContentAsBytes
Return resource as array of bytes- Parameters:
url- - String path (specific to certain context) to resource- Throws:
Exception
-
isModified
Return if resource has been modified since specific time- Parameters:
url- - String path (specific to certain context) to resourcelastAccess-
-
removeScheme
-