org.zkoss.web.util.resource
Class ResourceLoader<V>

java.lang.Object
  extended by org.zkoss.web.util.resource.ResourceLoader<V>
All Implemented Interfaces:
org.zkoss.util.resource.Loader<org.zkoss.web.util.resource.ResourceInfo,V>

public abstract class ResourceLoader<V>
extends Object
implements org.zkoss.util.resource.Loader<org.zkoss.web.util.resource.ResourceInfo,V>

A semi-implemented loader to used with ResourceCaches.get(org.zkoss.web.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<V>
 
Constructor Summary
protected ResourceLoader()
           
 
Method Summary
 long getLastModified(org.zkoss.web.util.resource.ResourceInfo src)
           
 V load(org.zkoss.web.util.resource.ResourceInfo src)
           
protected abstract  V 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.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).
protected abstract  V 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.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).
 boolean shallCheck(org.zkoss.web.util.resource.ResourceInfo 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 V 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.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).

Deriving must override this method.

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

parse

protected abstract V 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.web.util.resource.ResourceCache, javax.servlet.ServletContext, java.lang.String, java.lang.Object)).

Deriving must override this method.

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

shallCheck

public boolean shallCheck(org.zkoss.web.util.resource.ResourceInfo src,
                          long expiredMillis)
Specified by:
shallCheck in interface org.zkoss.util.resource.Loader<org.zkoss.web.util.resource.ResourceInfo,V>

getLastModified

public long getLastModified(org.zkoss.web.util.resource.ResourceInfo src)
Specified by:
getLastModified in interface org.zkoss.util.resource.Loader<org.zkoss.web.util.resource.ResourceInfo,V>

load

public V load(org.zkoss.web.util.resource.ResourceInfo src)
       throws Exception
Specified by:
load in interface org.zkoss.util.resource.Loader<org.zkoss.web.util.resource.ResourceInfo,V>
Throws:
Exception


Copyright © 2015. All rights reserved.