|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.web.util.resource.ResourceLoader<V>
public abstract class ResourceLoader<V>
A semi-implemented loader to used with ResourceCaches.get(org.zkoss.web.util.resource.ResourceCache
to retrieve servlet resources.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.zkoss.util.resource.Loader |
---|
Loader.Resource<V> |
Constructor Summary | |
---|---|
protected |
ResourceLoader()
|
Method Summary | |
---|---|
long |
getLastModified(org.zkoss.web.util.resource.ResourceInfo src)
Returns the last modified time, or -1 if reload is required or not exists. |
V |
load(org.zkoss.web.util.resource.ResourceInfo src)
Loads the resource. |
protected abstract V |
parse(java.lang.String path,
java.io.File file,
java.lang.Object extra)
Parses the specified file and returns the result which will be stored into the cache ( ResourceCaches.get(org.zkoss.web.util.resource.ResourceCache ). |
protected abstract V |
parse(java.lang.String path,
java.net.URL url,
java.lang.Object extra)
Parses the specified URL and returns the result which will be stored into the cache ( ResourceCaches.get(org.zkoss.web.util.resource.ResourceCache ). |
boolean |
shallCheck(org.zkoss.web.util.resource.ResourceInfo src,
long expiredMillis)
Returns whether to call Loader.getLastModified(K) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ResourceLoader()
Method Detail |
---|
protected abstract V parse(java.lang.String path, java.io.File file, java.lang.Object extra) throws java.lang.Exception
ResourceCaches.get(org.zkoss.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)
).
Deriving must override this method.
extra
- the extra parameter passed from ResourceCaches.get(org.zkoss.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)
.
java.lang.Exception
protected abstract V parse(java.lang.String path, java.net.URL url, java.lang.Object extra) throws java.lang.Exception
ResourceCaches.get(org.zkoss.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)
).
Deriving must override this method.
extra
- the extra parameter passed from ResourceCaches.get(org.zkoss.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)
.
java.lang.Exception
public boolean shallCheck(org.zkoss.web.util.resource.ResourceInfo src, long expiredMillis)
Loader
Loader.getLastModified(K)
.
If false, it assumes the current cached content is up-to-date.
shallCheck
in interface Loader<org.zkoss.web.util.resource.ResourceInfo,V>
expiredMillis
- how many milli-seconds are expired after the last
check. In most cases, just return true if expiredMillis > 0public long getLastModified(org.zkoss.web.util.resource.ResourceInfo src)
Loader
getLastModified
in interface Loader<org.zkoss.web.util.resource.ResourceInfo,V>
public V load(org.zkoss.web.util.resource.ResourceInfo src) throws java.lang.Exception
Loader
The returned resource could be anything. It will be returned
by ResourceCache.get(java.lang.Object)
.
However, if you want to have more control (e.g., whether to cache),
you can return an instance
of Loader.Resource
. Then, the return value of ResourceCache.get(java.lang.Object)
will be Loader.Resource.resource
.
load
in interface Loader<org.zkoss.web.util.resource.ResourceInfo,V>
java.lang.Exception
- you might throw any exception which will be
passed back to the caller of ResourceCache.get(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |