org.apache.velocity.runtime.resource.loader
クラス ClasspathResourceLoader

java.lang.Object
  拡張org.apache.velocity.runtime.resource.loader.ResourceLoader
      拡張org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

public class ClasspathResourceLoader
extends ResourceLoader

ClasspathResourceLoader is a simple loader that will load templates from the classpath.

Will load templates from from multiple instances of and arbitrary combinations of :

This is a configuration-free loader, in that there are no parameters to be specified in the configuration properties, other than specifying this as the loader to use. For example the following is all that the loader needs to be functional :

resource.loader = class class.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader

To use, put your template directories, jars and zip files into the classpath or other mechanisms that make resources accessable to the classloader.

This makes deployment trivial for web applications running in any Servlet 2.2 compliant servlet runner, such as Tomcat 3.2 and others.

For a Servlet Spec v2.2 servlet runner, just drop the jars of template files into the WEB-INF/lib directory of your webapp, and you won't have to worry about setting template paths or altering them with the root of the webapp before initializing.

I have also tried it with a WAR deployment, and that seemed to work just fine.

バージョン:
$Id: ClasspathResourceLoader.java,v 1.6.4.1 2002/03/28 15:17:53 geirm Exp $
作成者:
Geir Magnusson Jr.

フィールドの概要
 
クラス org.apache.velocity.runtime.resource.loader.ResourceLoader から継承したフィールド
className, isCachingOn, modificationCheckInterval, rsvc
 
コンストラクタの概要
ClasspathResourceLoader()
           
 
メソッドの概要
 long getLastModified(Resource resource)
          Defaults to return 0
 java.io.InputStream getResourceStream(java.lang.String name)
          Get an InputStream so that the Runtime can build a template with it.
 void init(org.apache.commons.collections.ExtendedProperties configuration)
          This is abstract in the base class, so we need it
 boolean isSourceModified(Resource resource)
          Defaults to return false.
 
クラス org.apache.velocity.runtime.resource.loader.ResourceLoader から継承したメソッド
commonInit, getClassName, getModificationCheckInterval, isCachingOn, setCachingOn, setModificationCheckInterval
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ClasspathResourceLoader

public ClasspathResourceLoader()
メソッドの詳細

init

public void init(org.apache.commons.collections.ExtendedProperties configuration)
This is abstract in the base class, so we need it

定義:
クラス ResourceLoader 内の init

getResourceStream

public java.io.InputStream getResourceStream(java.lang.String name)
                                      throws ResourceNotFoundException
Get an InputStream so that the Runtime can build a template with it.

定義:
クラス ResourceLoader 内の getResourceStream
パラメータ:
name - name of template to get
戻り値:
InputStream containing the template
例外:
ResourceNotFoundException - if template not found in classpath.

isSourceModified

public boolean isSourceModified(Resource resource)
Defaults to return false.

定義:
クラス ResourceLoader 内の isSourceModified

getLastModified

public long getLastModified(Resource resource)
Defaults to return 0

定義:
クラス ResourceLoader 内の getLastModified


Copyright © 2003 Apache Software Foundation. All Rights Reserved.