@DefaultKey(value="import") @ValidScope(value="request") public class ImportTool extends SafeConfig implements Serializable
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>
Modifier and Type | Field and Description |
---|---|
protected ImportSupport |
importSupport
ImportSupport utility which provides underlying i/o
|
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
Constructor and Description |
---|
ImportTool() |
Modifier and Type | Method and Description |
---|---|
protected void |
configure(ValueParser values)
Configuration
|
String |
fetch(String url)
Returns the supplied URL rendered as a String.
|
protected void |
initializeImportSupport(ValueParser config)
Importsupport initialization
|
String |
read(String resource)
Returns the supplied resource rendered as a String.
|
configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
protected transient ImportSupport importSupport
protected void initializeImportSupport(ValueParser config)
config
- configuration valuesprotected void configure(ValueParser values)
configure
in class SafeConfig
values
- configuration valuespublic String read(String resource)
resource
- the URL to importCopyright © 2002–2018 The Apache Software Foundation. All rights reserved.