org.zkoss.web.util.resource
Class ResourceLoader

java.lang.Object
  extended by org.zkoss.web.util.resource.ResourceLoader
All Implemented Interfaces:
org.zkoss.util.resource.Loader

public abstract class ResourceLoader
extends Object
implements org.zkoss.util.resource.Loader

A semi-implemented loader to used with ResourceCaches.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object) to retrieve servlet resources.

Author:
tomyeh

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.zkoss.util.resource.Loader
org.zkoss.util.resource.Loader.Resource
 
Constructor Summary
protected ResourceLoader()
           
 
Method Summary
 long getLastModified(Object src)
           
 Object load(Object src)
           
protected abstract  Object parse(String path, File file, Object extra)
          Parses the specified file and returns the result which will be stored into the cache (ResourceCaches.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).
protected abstract  Object parse(String path, URL url, Object extra)
          Parses the specified URL and returns the result which will be stored into the cache (ResourceCaches.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).
 boolean shallCheck(Object src, long expiredMillis)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceLoader

protected ResourceLoader()
Method Detail

parse

protected abstract Object parse(String path,
                                File file,
                                Object extra)
                         throws Exception
Parses the specified file and returns the result which will be stored into the cache (ResourceCaches.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).

Deriving must override this method.

Parameters:
extra - the extra paramter passed from ResourceCaches.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object).
Throws:
Exception

parse

protected abstract Object parse(String path,
                                URL url,
                                Object extra)
                         throws Exception
Parses the specified URL and returns the result which will be stored into the cache (ResourceCaches.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).

Deriving must override this method.

Parameters:
extra - the extra paramter passed from ResourceCaches.get(org.zkoss.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object).
Throws:
Exception

shallCheck

public boolean shallCheck(Object src,
                          long expiredMillis)
Specified by:
shallCheck in interface org.zkoss.util.resource.Loader

getLastModified

public long getLastModified(Object src)
Specified by:
getLastModified in interface org.zkoss.util.resource.Loader

load

public Object load(Object src)
            throws Exception
Specified by:
load in interface org.zkoss.util.resource.Loader
Throws:
Exception


Copyright © 2011. All Rights Reserved.