Package org.apache.myfaces.resource
Class FacesJSResourceLoader
java.lang.Object
org.apache.myfaces.resource.ResourceLoader
org.apache.myfaces.resource.ResourceLoaderWrapper
org.apache.myfaces.resource.FacesJSResourceLoader
- All Implemented Interfaces:
- FacesWrapper<ResourceLoader>
Resource loader coming in from our jakarta.faces library
 The problem why we need a specialized loader is:
 we have to append/change the mapping information in Development mode
 (and remove it if present for prod mode)
 according to the library name and request path
 Both values are dynamic and the request path is dependent on the
 patterns provided in the web.xml
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.myfaces.resource.ResourceLoaderResourceLoader.VersionComparator
- 
Field SummaryFieldsFields inherited from class org.apache.myfaces.resource.ResourceLoaderVERSION_INVALID
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncreateResourceMeta(String prefix, String libraryName, String libraryVersion, String resourceName, String resourceVersion) createResourceMeta(String prefix, String libraryName, String libraryVersion, String resourceName, String resourceVersion, String contractName) getLibraryVersion(String path) Return the max available version found (if exists) or return null if no version available.getResourceInputStream(ResourceMeta resourceMeta) this is the central part, we basically intercept the input stream via an internal pipe and change and add the information on the flygetResourceURL(ResourceMeta resourceMeta) Return the max available version found (if exists) or return null if no version available.getResourceVersion(String path) iterator(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options) booleanlibraryExists(String libraryName) booleanresourceExists(ResourceMeta resourceMeta) voidvoidsetVersionComparator(Comparator<String> versionComparator) 
- 
Field Details- 
SOURCE_MAP_MARKER- See Also:
 
 
- 
- 
Constructor Details- 
FacesJSResourceLoader
 
- 
- 
Method Details- 
getWrapped
- 
getResourceInputStreamthis is the central part, we basically intercept the input stream via an internal pipe and change and add the information on the fly What happens is that a request is coming in which tries to load a faces.js file. In development mode faces-development.js is loaded transparently. In production mode faces.js is loaded. Also, the request, in case of an extension based match, does not load the resource via the .js extension but via js.<match extension≫ aka faces.js becomes faces.js.jsf now this extension is dependent on the current match of the request triggering the Faces Servlet. In order to load the mapping files correctly we have to take this into consideration by adding in case of an extension match the match extensions. Also given that we only want to have mapping files in development mode we have to retarget the mapping file to faces-development.js.map no matter how the faces.js request looks like. For production mode we do not want to have any mapping request at all (for now)- Overrides:
- getResourceInputStreamin class- ResourceLoaderWrapper
- Parameters:
- resourceMeta- the incoming resource metadata for the faces.js resource
- Returns:
- an input stream on the resource or the mapped input stream which adds the map data
 
- 
getResourceVersion- Overrides:
- getResourceVersionin class- ResourceLoaderWrapper
 
- 
getLibraryVersionDescription copied from class:ResourceLoaderReturn the max available version found (if exists) or return null if no version available.- Overrides:
- getLibraryVersionin class- ResourceLoaderWrapper
 
- 
getResourceURLDescription copied from class:ResourceLoaderReturn the max available version found (if exists) or return null if no version available.- Overrides:
- getResourceURLin class- ResourceLoaderWrapper
 
- 
createResourceMetapublic ResourceMeta createResourceMeta(String prefix, String libraryName, String libraryVersion, String resourceName, String resourceVersion) - Overrides:
- createResourceMetain class- ResourceLoaderWrapper
 
- 
createResourceMetapublic ResourceMeta createResourceMeta(String prefix, String libraryName, String libraryVersion, String resourceName, String resourceVersion, String contractName) - Overrides:
- createResourceMetain class- ResourceLoader
 
- 
libraryExists- Overrides:
- libraryExistsin class- ResourceLoaderWrapper
 
- 
resourceExists- Overrides:
- resourceExistsin class- ResourceLoaderWrapper
 
- 
iteratorpublic Iterator<String> iterator(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options) - Overrides:
- iteratorin class- ResourceLoaderWrapper
 
- 
getVersionComparator- Overrides:
- getVersionComparatorin class- ResourceLoaderWrapper
 
- 
setVersionComparator- Overrides:
- setVersionComparatorin class- ResourceLoaderWrapper
 
- 
getPrefix- Overrides:
- getPrefixin class- ResourceLoaderWrapper
 
- 
setPrefix- Overrides:
- setPrefixin class- ResourceLoaderWrapper
 
 
-