org.apache.velocity.tools.view.tools
Class ImportTool

java.lang.Object
  extended byorg.apache.velocity.tools.view.ImportSupport
      extended byorg.apache.velocity.tools.view.tools.ImportTool
All Implemented Interfaces:
ViewTool

public class ImportTool
extends ImportSupport
implements ViewTool

General-purpose text-importing view 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:
 <tool>
   <key>import</key>
   <scope>request</scope>
   <class>org.apache.velocity.tools.view.tools.ImportTool</class>
 </tool>
 

Since:
VelocityTools 1.1
Version:
$Revision: 72114 $ $Date: 2004-11-10 22:26:27 -0800 (Wed, 10 Nov 2004) $
Author:
Marino A. Jonsson

Nested Class Summary
 
Nested classes inherited from class org.apache.velocity.tools.view.ImportSupport
ImportSupport.ImportResponseWrapper
 
Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Fields inherited from class org.apache.velocity.tools.view.ImportSupport
application, DEFAULT_ENCODING, isAbsoluteUrl, request, response, VALID_SCHEME_CHARS
 
Constructor Summary
ImportTool()
          Default constructor.
 
Method Summary
 void init(java.lang.Object obj)
          Initializes this tool.
 java.lang.String read(java.lang.String url)
          Returns the supplied URL rendered as a String.
 
Methods inherited from class org.apache.velocity.tools.view.ImportSupport
acquireReader, acquireString, getContentTypeAttribute, isAbsoluteUrl, stripSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

ImportTool

public ImportTool()
Default constructor. Tool must be initialized before use.

Method Detail

init

public void init(java.lang.Object obj)
Initializes this tool.

Specified by:
init in interface ViewTool
Parameters:
obj - the current ViewContext
Throws:
java.lang.IllegalArgumentException - if the param is not a ViewContext

read

public java.lang.String read(java.lang.String url)
Returns the supplied URL rendered as a String.

Parameters:
url - the URL to import
Returns:
the URL as a string


Copyright (c) 2003 Apache Software Foundation