Class ImportTool
- java.lang.Object
-
- org.apache.velocity.tools.generic.SafeConfig
-
- org.apache.velocity.tools.generic.ImportTool
-
- All Implemented Interfaces:
java.io.Serializable
@DefaultKey("import") @ValidScope("request") public class ImportTool extends SafeConfig implements java.io.Serializable
General-purpose text-importing tool for templates.Usage: just call $import.read("http://www.foo.com/bleh.jsp?sneh=bar") to insert the contents of the named resource into the template.
Toolbox configuration:
<tools> <toolbox scope="request"> <tool class="org.apache.velocity.tools.view.ImportTool"/> </toolbox> </tools>- Since:
- VelocityTools 3.0
- Version:
- $Id$
- Author:
- Marino A. Jonsson
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ImportSupportimportSupportImportSupport utility which provides underlying i/o-
Fields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
-
-
Constructor Summary
Constructors Constructor Description ImportTool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigure(ValueParser values)Configurationjava.lang.Stringfetch(java.lang.String url)Returns the supplied URL rendered as a String.protected voidinitializeImportSupport(ValueParser config)Importsupport initializationjava.lang.Stringread(java.lang.String resource)Returns the supplied resource rendered as a String.-
Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
-
-
-
-
Field Detail
-
importSupport
protected transient ImportSupport importSupport
ImportSupport utility which provides underlying i/o
-
-
Method Detail
-
initializeImportSupport
protected void initializeImportSupport(ValueParser config)
Importsupport initialization- Parameters:
config- configuration values
-
configure
protected void configure(ValueParser values)
Configuration- Overrides:
configurein classSafeConfig- Parameters:
values- configuration values
-
read
public java.lang.String read(java.lang.String resource)
Returns the supplied resource rendered as a String.- Parameters:
resource- the URL to import- Returns:
- the URL as a string
-
fetch
public java.lang.String fetch(java.lang.String url)
Returns the supplied URL rendered as a String.- Parameters:
url- the URL to import- Returns:
- the URL as a string
-
-