org.apache.commons.jelly.tags.util
Class LoadTextTag

java.lang.Object
  extended byorg.apache.commons.jelly.TagSupport
      extended byorg.apache.commons.jelly.tags.util.LoadTextTag
All Implemented Interfaces:
org.apache.commons.jelly.Tag

public class LoadTextTag
extends org.apache.commons.jelly.TagSupport

A tag which loads text from a file or URI into a Jelly variable.

Version:
$Revision: 155420 $
Author:
James Strachan

Field Summary
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
LoadTextTag()
           
 
Method Summary
 void doTag(org.apache.commons.jelly.XMLOutput output)
           
 java.lang.String getEncoding()
          Returns the encoding set.
 java.io.File getFile()
          Returns the file.
 java.lang.String getUri()
          Returns the uri.
 java.lang.String getVar()
          Returns the var.
protected  java.lang.String loadText(java.io.Reader reader)
          Loads all the text from the given Reader
 void setEncoding(java.lang.String encoding)
          Sets the encoding to use to read the file
 void setFile(java.io.File file)
          Sets the file to be parsed as text
 void setUri(java.lang.String uri)
          Sets the uri to be parsed as text.
 void setVar(java.lang.String var)
          Sets the name of the variable which will be exported with the text value of the given file.
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadTextTag

public LoadTextTag()
Method Detail

doTag

public void doTag(org.apache.commons.jelly.XMLOutput output)
           throws org.apache.commons.jelly.MissingAttributeException,
                  org.apache.commons.jelly.JellyTagException
Throws:
org.apache.commons.jelly.MissingAttributeException
org.apache.commons.jelly.JellyTagException

setVar

public void setVar(java.lang.String var)
Sets the name of the variable which will be exported with the text value of the given file.


getFile

public java.io.File getFile()
Returns the file.

Returns:
File

getUri

public java.lang.String getUri()
Returns the uri.

Returns:
String

getVar

public java.lang.String getVar()
Returns the var.

Returns:
String

setFile

public void setFile(java.io.File file)
Sets the file to be parsed as text


setEncoding

public void setEncoding(java.lang.String encoding)
Sets the encoding to use to read the file


setUri

public void setUri(java.lang.String uri)
Sets the uri to be parsed as text. This can be an absolute URL or a relative or absolute URI from this Jelly script or the root context.


getEncoding

public java.lang.String getEncoding()
Returns the encoding set.

Returns:
the encoding set with setEncoding(String)

loadText

protected java.lang.String loadText(java.io.Reader reader)
                             throws java.io.IOException
Loads all the text from the given Reader

Throws:
java.io.IOException


Copyright © 2002-2006 Apache Software Foundation. All Rights Reserved.