|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.zkoss.web.util.resource.ResourceCaches
public class ResourceCaches
Utilities to load (and parse) the servlet resource.
Usage 1:
getContent(javax.servlet.ServletContext, java.lang.String)
to load the resource into a String-type content.
Usage 2:
ResourceLoader
.ResourceCache
)
by use of the loader in the previous step.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)
to load the resource.Usage 2 has better performance because you need to parse the content only once. Usage 1 is simple if you don't pase it into any intermediate format.
Constructor Summary | |
---|---|
ResourceCaches()
|
Method Summary | |
---|---|
static java.lang.Object |
get(ResourceCache cache,
javax.servlet.ServletContext ctx,
java.lang.String path,
java.lang.Object extra)
Loads, parses and returns the resource of the specified URI, or null if not found. |
static java.lang.String |
getContent(javax.servlet.ServletContext ctx,
java.lang.String path)
Returns the content of the specified path, or null if not found. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceCaches()
Method Detail |
---|
public static final java.lang.Object get(ResourceCache cache, javax.servlet.ServletContext ctx, java.lang.String path, java.lang.Object extra)
ResourceCache
.
If you don't need to parse the content, you might use
getContent(javax.servlet.ServletContext, java.lang.String)
cache
- the resource cache.
Note: its loader must extend from ResourceLoader
.path
- the URI pathextra
- the extra parameter that will be passed to
ResourceLoader.parse(String,File,Object)
and
ResourceLoader.parse(String,URL,Object)
public static final java.lang.String getContent(javax.servlet.ServletContext ctx, java.lang.String path)
The content is returned directly as a string without any parsing.
Note: the encoding is assumed to be "UTF-8".
path
- the URI path
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |