|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.resource.ResourceManager
The resource manager manages resources in the application, session or request scope.
Field Summary | |
private static java.lang.String |
cacheDir
Directory for the Resource Cache |
private static org.apache.commons.logging.Log |
log
Logging instance |
Constructor Summary | |
private |
ResourceManager()
Constructor for ResourceManager |
Method Summary | |
static java.lang.String |
getCacheDir()
Returns the directory used to cache resources. |
static Resource |
getResource(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
java.lang.String key)
Returns a registered resource out of the cache |
private static java.util.Hashtable |
getResourceCache(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
boolean create)
Returns the hashtable with resources in the specified scope |
private static java.util.Hashtable |
getResourceCache(javax.servlet.ServletContext context,
boolean create)
Returns the hashtable with resources in the application scope |
static Resource |
getResourceFromURI(javax.servlet.http.HttpServletRequest request,
java.lang.String uri)
Returns a registered resource from the request cache. |
static java.lang.String |
getResourceURI(javax.servlet.jsp.PageContext ctx,
HttpScope scope,
java.lang.String key,
Cachable cacheInfo)
Returns a URI for the specified resource This can be the filename, which is used to store the file on the disk |
static java.lang.String |
getResourceURI(javax.servlet.jsp.PageContext ctx,
HttpScope scope,
java.lang.String key,
Cachable cacheInfo,
boolean contextRelative)
Returns a URI for the specified resource This can be the filename, which is used to store the file on the disk |
static boolean |
isUpToDate(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
java.lang.String key,
Cachable cacheInfo)
Checks if a registered resource is up to date |
static void |
registerResource(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
java.lang.String key,
java.awt.image.BufferedImage image,
Cachable cacheInfo)
Registers a JPEG resource |
static void |
registerResource(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
java.lang.String key,
MimeType type,
byte[] body,
Cachable cacheInfo)
Registers a binary resource |
static void |
registerResource(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
java.lang.String key,
MimeType type,
java.lang.String bodyStream,
Cachable cacheInfo)
Registers a binary resource |
static void |
registerResource(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
java.lang.String key,
java.lang.Object object,
Cachable cacheInfo)
Registers a object resource |
static void |
registerResource(javax.servlet.http.HttpServletRequest request,
HttpScope scope,
java.lang.String key,
Resource resource)
Register a resource in the specified scope |
static void |
registerResource(javax.servlet.ServletContext context,
java.lang.String key,
Resource resource)
Register a resource in the application scope |
static void |
setCacheDir(java.lang.String newCacheDir)
Sets the directory which should be used to cache resources. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.apache.commons.logging.Log log
private static java.lang.String cacheDir
Constructor Detail |
private ResourceManager()
Method Detail |
public static void registerResource(javax.servlet.http.HttpServletRequest request, HttpScope scope, java.lang.String key, java.awt.image.BufferedImage image, Cachable cacheInfo)
request
- HttpServletRequestscope
- The scope where to register the Resourcekey
- The resource keyimage
- the image to registercacheInfo
- optional caching informationpublic static void registerResource(javax.servlet.http.HttpServletRequest request, HttpScope scope, java.lang.String key, MimeType type, byte[] body, Cachable cacheInfo)
request
- HttpServletRequestscope
- HttpScopekey
- Keytype
- MimeTypebody
- Resource to registercacheInfo
- Cachablepublic static void registerResource(javax.servlet.http.HttpServletRequest request, HttpScope scope, java.lang.String key, MimeType type, java.lang.String bodyStream, Cachable cacheInfo)
request
- HttpServletRequestscope
- HttpScopekey
- Keytype
- MimeTypebodyStream
- Object to registercacheInfo
- Cachablepublic static void registerResource(javax.servlet.http.HttpServletRequest request, HttpScope scope, java.lang.String key, java.lang.Object object, Cachable cacheInfo)
request
- HttpServletRequestscope
- HttpScopekey
- Keyobject
- Object to registercacheInfo
- Cachablepublic static void registerResource(javax.servlet.http.HttpServletRequest request, HttpScope scope, java.lang.String key, Resource resource)
request
- HttpServletRequestscope
- HttpScopekey
- Keyresource
- Resourcepublic static void registerResource(javax.servlet.ServletContext context, java.lang.String key, Resource resource)
context
- ServletContextkey
- Keyresource
- Resourcepublic static java.lang.String getResourceURI(javax.servlet.jsp.PageContext ctx, HttpScope scope, java.lang.String key, Cachable cacheInfo)
ctx
- PageContextscope
- HttpScopekey
- KeycacheInfo
- Caching Information about the Resource or null
public static java.lang.String getResourceURI(javax.servlet.jsp.PageContext ctx, HttpScope scope, java.lang.String key, Cachable cacheInfo, boolean contextRelative)
ctx
- PageContextscope
- HttpScopekey
- KeycacheInfo
- Caching Information about the Resource or null
contextRelative
- true
the applications
context path will not be added to the URI.false
the applications
context path (= context absolute) will be added to the
URIpublic static boolean isUpToDate(javax.servlet.http.HttpServletRequest request, HttpScope scope, java.lang.String key, Cachable cacheInfo)
request
- The HttpServletRequestscope
- HttpScopekey
- KeycacheInfo
- Cachable
public static Resource getResourceFromURI(javax.servlet.http.HttpServletRequest request, java.lang.String uri)
request
- The HttpServletRequesturi
- The URI for the registered resource
public static Resource getResource(javax.servlet.http.HttpServletRequest request, HttpScope scope, java.lang.String key)
request
- The HttpServletRequestscope
- HttpScopekey
- Key
private static java.util.Hashtable getResourceCache(javax.servlet.http.HttpServletRequest request, HttpScope scope, boolean create)
request
- HttpServletRequestscope
- HttpScopecreate
- true, if a new Resource table should be created
private static java.util.Hashtable getResourceCache(javax.servlet.ServletContext context, boolean create)
context
- ServletContextcreate
- true, if a new Resource table should be created
public static java.lang.String getCacheDir()
public static void setCacheDir(java.lang.String newCacheDir)
newCacheDir
- The cache directory
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |