Class ResourceResolver

java.lang.Object
org.exoplatform.resolver.ResourceResolver
Direct Known Subclasses:
ApplicationResourceResolver, ClasspathResourceResolver, FileResourceResolver, MockResourceResolver, PortletResourceResolver, ServletResourceResolver

public abstract class ResourceResolver extends Object
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
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 Details

    • ResourceResolver

      public ResourceResolver()
  • Method Details

    • getResource

      public abstract URL getResource(String url) throws Exception
      Return URL object to resource
      Parameters:
      url - - String path (specific to certain context) to resource
      Throws:
      Exception
    • getInputStream

      public abstract InputStream getInputStream(String url) throws Exception
      Return InputStream object to resource
      Parameters:
      url - - String path (specific to certain context) to resource
      Throws:
      Exception
    • getResources

      public abstract List<URL> getResources(String url) throws Exception
      Return List of URL object to resource
      Parameters:
      url - - String path (specific to certain context) to resource
      Throws:
      Exception
    • getInputStreams

      public abstract List<InputStream> getInputStreams(String url) throws Exception
      Return List of InputStream object to resource
      Parameters:
      url - - String path (specific to certain context) to resource
      Throws:
      Exception
    • getWebAccessPath

      public String getWebAccessPath(String url)
    • getResourceScheme

      public abstract String getResourceScheme()
    • getRealPath

      public String getRealPath(String url)
    • createResourceKey

      public ResourceKey createResourceKey(String url)
      Return ResourceKey object

      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

      public String createResourceId(String url)
      Return resource id
      Parameters:
      url - - String path (specific to certain context) to resource
    • isResolvable

      public boolean isResolvable(String url)
      Return if this can resolve resource with specific url
      Parameters:
      url - String path to resource
    • getResourceContentAsBytes

      public byte[] getResourceContentAsBytes(String url) throws Exception
      Return resource as array of bytes
      Parameters:
      url - - String path (specific to certain context) to resource
      Throws:
      Exception
    • isModified

      public abstract boolean isModified(String url, long lastAccess)
      Return if resource has been modified since specific time
      Parameters:
      url - - String path (specific to certain context) to resource
      lastAccess -
    • removeScheme

      protected String removeScheme(String url)