ResourceInfo instances and cache any that are successfully looked up to reduce
the computational overhead with the scanning/version checking.
| Modifier and Type | Field and Description |
|---|---|
| private final ResourceCache | cache
Cache for storing |
| private final ClasspathResourceHelper | classpathResourceHelper
|
| private List | compressableTypes
Patterns used to find |
| private static final Pattern | CONFIG_MIMETYPE_PATTERN
|
| private final FaceletWebappResourceHelper | faceletWebappResourceHelper
|
| private final ReentrantLock | lock
This lock is used to ensure the lookup of compressable |
| private static final Logger | |
| private final WebappResourceHelper | webappResourceHelper
|
| Access | Constructor and Description |
|---|---|
| public | |
| public | ResourceManager(Map<String, Object>
the application map appMap, ResourceCache the resource cache cache)Constructs a new |
| Modifier and Type | Method and Description |
|---|---|
| private void | addToCache(ResourceInfo
the @{link ResourceInfo} to add. info, List<String> the contracts contracts)Adds the the specified |
| private ResourceInfo | Returns: aResourceInfo if a resource if found matching the provided arguments, otherwise, return
nullthe name of the library (if any) libraryName, String the name of the resource resourceName, String the locale prefix for this resource (if any) localePrefix, boolean if this resource can be compressed compressable, boolean isViewResource, List<String> the contracts to consider contracts, FacesContext the ctx)jakarta. for the current requestAttempt to look up the Resource based on the provided details. |
| pack-priv LibraryInfo | Returns: the Library instance for the specified librarythe library to find libraryName, String the prefix for the desired locale localePrefix, String the contract to use contract, FacesContext the ctx)jakarta. for the current request
Attempt to lookup and return a |
| pack-priv LibraryInfo | findLibraryOnClasspathWithZipDirectoryEntryScan(String libraryName, String localePrefix, String contract, FacesContext ctx, boolean forceScan)
|
| public ResourceInfo | Returns: aResourceInfo if a resource if found matching the provided arguments, otherwise, return
nullthe name of the library (if any) libraryName, String the name of the resource resourceName, String the content type of the resource. This will be used to determine if the resource is compressable contentType, FacesContext the ctx)jakarta. for the current request
Attempt to lookup a Implementation Note Synchronization is necessary when looking up compressed resources. |
| public ResourceInfo | findResource(String libraryName, String resourceName, String contentType, boolean isViewResource, FacesContext ctx)
|
| private ResourceInfo | Returns: the Library instance for the specified librarythe library the resource should be found in library, String the name of the resource resourceName, String the prefix for the desired locale localePrefix, boolean true if the resource can be compressedthe ctx)jakarta. for the current request
Attempt to lookup and return a |
| pack-priv ResourceInfo | |
| private ResourceInfo | findResourceCompressed(String libraryName, String resourceName, boolean isViewResource, String localePrefix, List<String> contracts, FacesContext ctx)
|
| private ResourceInfo | findResourceNonCompressed(String libraryName, String resourceName, boolean isViewResource, String localePrefix, List<String> contracts, FacesContext ctx)
|
| public ResourceInfo | |
| public String | |
| private ResourceInfo | |
| private String | Returns: the localePrefix based on the current request, ornull if no prefix can be determinedthe context)FacesContext for the current requestObtains the application configured message resources for the current request locale. |
| private ResourceInfo | getResourceInfo(String libraryName, String resourceName, String localePrefix, String contract, boolean compressable, boolean isViewResource, FacesContext ctx, LibraryInfo library)
|
| private List | |
| public Stream | getViewResources(FacesContext facesContext, String path, int maxDepth, ResourceVisitOption... options)
|
| private void | |
| private boolean | Returns: true if this resource can be compressed, otherwise falsecontent-type in question contentType, FacesContext the @{link FacesContext} for the current request ctx)
|
| public boolean | |
| private boolean | Returns: true if the input matches the expected pattern, otherwise falseinput mime-type pattern from the configuration input)
|
| private String | |
| pack-priv static boolean | |
| private String |
| cache | back to summary |
|---|---|
| private final ResourceCache cache Cache for storing | |
| classpathResourceHelper | back to summary |
|---|---|
| private final ClasspathResourceHelper classpathResourceHelper
| |
| compressableTypes | back to summary |
|---|---|
| private List<Pattern> compressableTypes Patterns used to find | |
| CONFIG_MIMETYPE_PATTERN | back to summary |
|---|---|
| private static final Pattern CONFIG_MIMETYPE_PATTERN
| |
| faceletWebappResourceHelper | back to summary |
|---|---|
| private final FaceletWebappResourceHelper faceletWebappResourceHelper
| |
| lock | back to summary |
|---|---|
| private final ReentrantLock lock This lock is used to ensure the lookup of compressable | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| webappResourceHelper | back to summary |
|---|---|
| private final WebappResourceHelper webappResourceHelper
| |
| ResourceManager | back to summary |
|---|---|
| public ResourceManager(ResourceCache cache) | |
| ResourceManager | back to summary |
|---|---|
| public ResourceManager(Map<String, Object> appMap, ResourceCache cache) Constructs a new Note if the current
| |
| addToCache | back to summary |
|---|---|
| private void addToCache(ResourceInfo info, List<String> contracts) Adds the the specified
| |
| doLookup | back to summary |
|---|---|
| private ResourceInfo doLookup(String libraryName, String resourceName, String localePrefix, boolean compressable, boolean isViewResource, List<String> contracts, FacesContext ctx) Attempt to look up the Resource based on the provided details.
| |
| findLibrary | back to summary |
|---|---|
| pack-priv LibraryInfo findLibrary(String libraryName, String localePrefix, String contract, FacesContext ctx)
Attempt to lookup and return a The lookup process will first search the file system of the web application *within the resources directory*. If the library is not found, then it processed to searching the classpath, if not found there, search from the webapp root *excluding* the resources directory.
If a library is found, this method will return a
| |
| findLibraryOnClasspathWithZipDirectoryEntryScan | back to summary |
|---|---|
| pack-priv LibraryInfo findLibraryOnClasspathWithZipDirectoryEntryScan(String libraryName, String localePrefix, String contract, FacesContext ctx, boolean forceScan) | |
| findResource | back to summary |
|---|---|
| public ResourceInfo findResource(String libraryName, String resourceName, String contentType, FacesContext ctx)
Attempt to lookup a Implementation Note Synchronization is necessary when looking up compressed resources. This ensures the atomicity of the content being compressed. As such, the cost of doing this is low as once the resource is in the cache, the lookup won't be performed again until the cache is cleared. That said, it's not a good idea to have caching disabled in a production environment if leveraging compression. If the resource isn't compressable, then we don't worry about creating a few extra copies of ResourceInfo until the cache is populated.
| |
| findResource | back to summary |
|---|---|
| public ResourceInfo findResource(String libraryName, String resourceName, String contentType, boolean isViewResource, FacesContext ctx) | |
| findResource | back to summary |
|---|---|
| private ResourceInfo findResource(LibraryInfo library, String resourceName, String localePrefix, boolean compressable, boolean skipToFaceletResourceHelper, FacesContext ctx)
Attempt to lookup and return a The lookup process will first search the file system of the web application. If the library is not found, then it processed to searching the classpath.
If a library is found, this method will return a
| |
| findResource | back to summary |
|---|---|
| pack-priv ResourceInfo findResource(String resourceId) | |
| findResourceCompressed | back to summary |
|---|---|
| private ResourceInfo findResourceCompressed(String libraryName, String resourceName, boolean isViewResource, String localePrefix, List<String> contracts, FacesContext ctx) | |
| findResourceNonCompressed | back to summary |
|---|---|
| private ResourceInfo findResourceNonCompressed(String libraryName, String resourceName, boolean isViewResource, String localePrefix, List<String> contracts, FacesContext ctx) | |
| findViewResource | back to summary |
|---|---|
| public ResourceInfo findViewResource(String resourceName, String contentType, FacesContext facesContext) | |
| getBaseContractsPath | back to summary |
|---|---|
| public String getBaseContractsPath() | |
| getFromCache | back to summary |
|---|---|
private ResourceInfo getFromCache(String name, String library, String localePrefix, List<String> contracts)
| |
| getLocalePrefix | back to summary |
|---|---|
| private String getLocalePrefix(FacesContext context)
Obtains the application configured message resources for the current request locale. If a ResourceBundle is found and
contains the key
For example, say the request locale is en_US, and
| |
| getResourceInfo | back to summary |
|---|---|
| private ResourceInfo getResourceInfo(String libraryName, String resourceName, String localePrefix, String contract, boolean compressable, boolean isViewResource, FacesContext ctx, LibraryInfo library) | |
| getResourceLibraryContracts | back to summary |
|---|---|
| private List | |
| getViewResources | back to summary |
|---|---|
| public Stream | |
| initCompressableTypes | back to summary |
|---|---|
| private void initCompressableTypes(Map<String, Object> appMap) Init | |
| isCompressable | back to summary |
|---|---|
private boolean isCompressable(String contentType, FacesContext ctx)
| |
| isContractsResource | back to summary |
|---|---|
| public boolean isContractsResource(String path) | |
| isPatternValid | back to summary |
|---|---|
private boolean isPatternValid(String input)
| |
| libraryNameFromContracts | back to summary |
|---|---|
| private String libraryNameFromContracts(String libraryName, List<String> contracts) | |
| nameContainsForbiddenSequence | back to summary |
|---|---|
| pack-priv static boolean nameContainsForbiddenSequence(String name) | |
| trimLeadingSlash | back to summary |
|---|---|
| private String trimLeadingSlash(String s) | |