Class ExtendletLoader<V>
parse(java.io.InputStream, java.lang.String, java.lang.String)
and getExtendletContext().
If the real path is not the same as the path specified in URL,
you can override getRealPath(java.lang.String).
- Since:
- 3.0.6
- Author:
- tomyeh
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.zkoss.util.resource.Loader
Loader.Resource<V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the check period, or -1 if the content is never changed.protected abstract ExtendletContextReturns the extendlet context.longgetLastModified(String src) Returns the last modified time.protected StringgetRealPath(String path) Returns the real path for the specified path.Loads the resource.protected abstract Vparse(InputStream is, String path, String orgpath) It is called to parse the resource into an intermediate format depending onExtendlet.booleanshallCheck(String src, long expiredMillis) Returns whether to callLoader.getLastModified(K).
-
Constructor Details
-
ExtendletLoader
protected ExtendletLoader()
-
-
Method Details
-
getRealPath
Returns the real path for the specified path.Default: return path, i.e., the path specified in URL is the real path.
Notice that
parse(java.io.InputStream, java.lang.String, java.lang.String)will receive the original path (rather than the returned path).- Parameters:
path- the path specified in URL. Notice that it does NOT start with "~./". Rather it starts with "/". For example, "/zul/css/zk.wcs".- Since:
- 5.0.0
-
shallCheck
Description copied from interface:LoaderReturns whether to callLoader.getLastModified(K). If false, it assumes the current cached content is up-to-date.- Specified by:
shallCheckin interfaceLoader<String,V> expiredMillis- how many milli-seconds are expired after the last check. In most cases, just return true if expiredMillis > 0
-
getLastModified
Returns the last modified time.- Specified by:
getLastModifiedin interfaceLoader<String,V>
-
load
Description copied from interface:LoaderLoads the resource.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 ofLoader.Resource. Then, the return value ofResourceCache.get(java.lang.Object)will beLoader.Resource.resource. -
parse
It is called to parse the resource into an intermediate format depending onExtendlet.The object is returned directly by
load(java.lang.String), so you can return an instance of org.zkoss.util.resource.Loader.Resource to have more control onResourceCache.- Parameters:
is- the content of the resourcepath- the path of the resource. It is the value returned bygetRealPath(java.lang.String), so called the real pathorgpath- the original path. It is the path passed to thepathargument ofgetRealPath(java.lang.String). It is useful if you want to retrieve the additional information encoded into the URI.- Throws:
Exception- Since:
- 5.0.0
-
getExtendletContext
Returns the extendlet context. -
getCheckPeriod
public int getCheckPeriod()Returns the check period, or -1 if the content is never changed. Unit: milliseconds.Default: It checks if an integer (unit: second) is assigned to a system property called org.zkoss.util.resource.extendlet.checkPeriod. If no such system property, -1 is assumed (never change). For the runtime environment the content is never changed, since all extendlet resources are packed in JAR files.
-