org.apache.myfaces.shared.resource
Class ExternalContextResourceLoader

java.lang.Object
  extended by org.apache.myfaces.shared.resource.ResourceLoader
      extended by org.apache.myfaces.shared.resource.ExternalContextResourceLoader

public class ExternalContextResourceLoader
extends ResourceLoader

A resource loader implementation which loads resources from the webapp root. It uses the methods on ExternalContext for handle resources.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.myfaces.shared.resource.ResourceLoader
ResourceLoader.VersionComparator
 
Field Summary
protected static java.util.regex.Pattern RESOURCE_VERSION_CHECKER
          It checks version like this: /1.js, /1_0.js, /1_0_0.js, /100_100.js Used on getResourceVersion to filter resources
protected static java.util.regex.Pattern VERSION_CHECKER
          It checks version like this: /1/, /1_0/, /1_0_0/, /100_100/ Used on getLibraryVersion to filter resource directories
 
Fields inherited from class org.apache.myfaces.shared.resource.ResourceLoader
VERSION_INVALID
 
Constructor Summary
ExternalContextResourceLoader(java.lang.String prefix)
           
 
Method Summary
 ResourceMeta createResourceMeta(java.lang.String prefix, java.lang.String libraryName, java.lang.String libraryVersion, java.lang.String resourceName, java.lang.String resourceVersion)
           
 java.lang.String getLibraryVersion(java.lang.String path)
          Return the max available version found (if exists) or return null if no version available.
 java.io.InputStream getResourceInputStream(ResourceMeta resourceMeta)
           
protected  java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)
           
 java.net.URL getResourceURL(ResourceMeta resourceMeta)
          Return the max available version found (if exists) or return null if no version available.
 java.lang.String getResourceVersion(java.lang.String path)
           
 boolean libraryExists(java.lang.String libraryName)
           
 
Methods inherited from class org.apache.myfaces.shared.resource.ResourceLoader
getPrefix, getVersionComparator, setPrefix, setVersionComparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION_CHECKER

protected static java.util.regex.Pattern VERSION_CHECKER
It checks version like this: /1/, /1_0/, /1_0_0/, /100_100/ Used on getLibraryVersion to filter resource directories


RESOURCE_VERSION_CHECKER

protected static java.util.regex.Pattern RESOURCE_VERSION_CHECKER
It checks version like this: /1.js, /1_0.js, /1_0_0.js, /100_100.js Used on getResourceVersion to filter resources

Constructor Detail

ExternalContextResourceLoader

public ExternalContextResourceLoader(java.lang.String prefix)
Method Detail

getResourcePaths

protected java.util.Set<java.lang.String> getResourcePaths(java.lang.String path)

getResourceVersion

public java.lang.String getResourceVersion(java.lang.String path)
Specified by:
getResourceVersion in class ResourceLoader

getLibraryVersion

public java.lang.String getLibraryVersion(java.lang.String path)
Description copied from class: ResourceLoader
Return the max available version found (if exists) or return null if no version available.

Specified by:
getLibraryVersion in class ResourceLoader

getResourceURL

public java.net.URL getResourceURL(ResourceMeta resourceMeta)
Description copied from class: ResourceLoader
Return the max available version found (if exists) or return null if no version available.

Specified by:
getResourceURL in class ResourceLoader

getResourceInputStream

public java.io.InputStream getResourceInputStream(ResourceMeta resourceMeta)
Specified by:
getResourceInputStream in class ResourceLoader

createResourceMeta

public ResourceMeta createResourceMeta(java.lang.String prefix,
                                       java.lang.String libraryName,
                                       java.lang.String libraryVersion,
                                       java.lang.String resourceName,
                                       java.lang.String resourceVersion)
Specified by:
createResourceMeta in class ResourceLoader

libraryExists

public boolean libraryExists(java.lang.String libraryName)
Specified by:
libraryExists in class ResourceLoader


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.