Class URLResourceLoader
- java.lang.Object
-
- org.apache.velocity.runtime.resource.loader.ResourceLoader
-
- org.apache.velocity.runtime.resource.loader.URLResourceLoader
-
public class URLResourceLoader extends ResourceLoader
This is a simple URL-based loader.- Since:
- 1.5
- Version:
- $Id: URLResourceLoader.java 191743 2005-06-21 23:22:20Z dlr $
- Author:
- Geir Magnusson Jr., Nathan Bubna
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>templateRoots-
Fields inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
className, isCachingOn, log, modificationCheckInterval, rsvc
-
-
Constructor Summary
Constructors Constructor Description URLResourceLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetLastModified(Resource resource)Checks to see when a resource was last modifiedReadergetResourceReader(String name, String encoding)Get a Reader so that the Runtime can build a template with it.intgetTimeout()Returns the current, custom timeout setting.voidinit(ExtProperties configuration)Initialize the template loader with a a resources class.booleanisSourceModified(Resource resource)Checks to see if a resource has been deleted, moved or modified.-
Methods inherited from class org.apache.velocity.runtime.resource.loader.ResourceLoader
buildReader, commonInit, getClassName, getModificationCheckInterval, isCachingOn, resourceExists, setCachingOn, setModificationCheckInterval
-
-
-
-
Method Detail
-
init
public void init(ExtProperties configuration)
Description copied from class:ResourceLoaderInitialize the template loader with a a resources class.- Specified by:
initin classResourceLoader- Parameters:
configuration-- See Also:
ResourceLoader.init(org.apache.velocity.util.ExtProperties)
-
getResourceReader
public Reader getResourceReader(String name, String encoding) throws ResourceNotFoundException
Get a Reader so that the Runtime can build a template with it.- Specified by:
getResourceReaderin classResourceLoader- Parameters:
name- name of template to fetch bytestream ofencoding- asked encoding- Returns:
- InputStream containing the template
- Throws:
ResourceNotFoundException- if template not found in the file template path.- Since:
- 2.0
-
isSourceModified
public boolean isSourceModified(Resource resource)
Checks to see if a resource has been deleted, moved or modified.- Specified by:
isSourceModifiedin classResourceLoader- Parameters:
resource- Resource The resource to check for modification- Returns:
- boolean True if the resource has been modified, moved, or unreachable
-
getLastModified
public long getLastModified(Resource resource)
Checks to see when a resource was last modified- Specified by:
getLastModifiedin classResourceLoader- Parameters:
resource- Resource the resource to check- Returns:
- long The time when the resource was last modified or 0 if the file can't be reached
-
getTimeout
public int getTimeout()
Returns the current, custom timeout setting. If negative, there is no custom timeout.- Returns:
- timeout
- Since:
- 1.6
-
-