Class InternalResourceMap
- java.lang.Object
-
- com.github.bordertech.wcomponents.InternalResourceMap
-
public final class InternalResourceMap extends Object
The ImageResourceMap map keeps a reference to all internal resources within an application. It is used by the WContentHelperServlet to efficiently serve binary data without having to go through normal WComponent processing.
Two things stop this map from consuming excessive amounts of memory:- InternalResources are files which are present in the classpath. There will be a finite set.
- The InternalResource implementation does not hold the file data, just a reference to the file.
- Since:
- 1.0.0
- Author:
- Yiannis Paschalidis
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
computeHash(InternalResource resource)
Computes a simple hash of the resource contents.static InternalResource
getResource(String path)
Retrieves a resource from the resource map.static String
getResourceCacheKey(String path)
Retrieves the cache key for a resource path.static void
registerResource(InternalResource resource)
Adds a resource to the resource map.
-
-
-
Method Detail
-
registerResource
public static void registerResource(InternalResource resource)
Adds a resource to the resource map.- Parameters:
resource
- the resource.
-
getResource
public static InternalResource getResource(String path)
Retrieves a resource from the resource map.- Parameters:
path
- the path to the resource.- Returns:
- the resource path.
-
getResourceCacheKey
public static String getResourceCacheKey(String path)
Retrieves the cache key for a resource path.- Parameters:
path
- the path to the resource.- Returns:
- the resource cache key.
-
computeHash
public static String computeHash(InternalResource resource)
Computes a simple hash of the resource contents.- Parameters:
resource
- the resource to hash.- Returns:
- a hash of the resource contents.
-
-