Class ExtendletLoader<V>
- java.lang.Object
-
- org.zkoss.web.util.resource.ExtendletLoader<V>
-
- All Implemented Interfaces:
org.zkoss.util.resource.Loader<java.lang.String,V>
public abstract class ExtendletLoader<V> extends java.lang.Object implements org.zkoss.util.resource.Loader<java.lang.String,V>A skeletal implementation of the loader used to implement an extendlet. All you have to do is to implementparse(java.io.InputStream, java.lang.String, java.lang.String)andgetExtendletContext().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:
Extendlet
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedExtendletLoader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intgetCheckPeriod()Returns the check period, or -1 if the content is never changed.protected abstract ExtendletContextgetExtendletContext()Returns the extendlet context.longgetLastModified(java.lang.String src)Returns the last modified time.protected java.lang.StringgetRealPath(java.lang.String path)Returns the real path for the specified path.Vload(java.lang.String src)protected abstract Vparse(java.io.InputStream is, java.lang.String path, java.lang.String orgpath)It is called to parse the resource into an intermediate format depending onExtendlet.booleanshallCheck(java.lang.String src, long expiredMillis)
-
-
-
Method Detail
-
getRealPath
protected java.lang.String getRealPath(java.lang.String path)
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
public boolean shallCheck(java.lang.String src, long expiredMillis)- Specified by:
shallCheckin interfaceorg.zkoss.util.resource.Loader<java.lang.String,V>
-
getLastModified
public long getLastModified(java.lang.String src)
Returns the last modified time.- Specified by:
getLastModifiedin interfaceorg.zkoss.util.resource.Loader<java.lang.String,V>
-
load
public V load(java.lang.String src) throws java.lang.Exception
- Specified by:
loadin interfaceorg.zkoss.util.resource.Loader<java.lang.String,V>- Throws:
java.lang.Exception
-
parse
protected abstract V parse(java.io.InputStream is, java.lang.String path, java.lang.String orgpath) throws java.lang.Exception
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:
java.lang.Exception- Since:
- 5.0.0
-
getExtendletContext
protected abstract ExtendletContext 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.
-
-