|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.apache.velocity.app.Velocity
This class provides services to the application developer, such as :
| Constructor Summary | |
Velocity()
|
|
| Method Summary | |
static void |
addProperty(java.lang.String key,
java.lang.Object value)
Add a Velocity Runtime property. |
static void |
clearProperty(java.lang.String key)
Clear a Velocity Runtime property. |
static boolean |
evaluate(Context context,
java.io.Writer writer,
java.lang.String logTag,
java.io.InputStream instream)
Renders the input stream using the context into the output writer. |
static boolean |
evaluate(Context context,
java.io.Writer out,
java.lang.String logTag,
java.lang.String instring)
renders the input string using the context into the output writer. |
static java.lang.Object |
getProperty(java.lang.String key)
Get a Velocity Runtime property. |
static Template |
getTemplate(java.lang.String name)
Returns a Template from the Velocity
resource management system. |
static void |
init()
initialize the Velocity runtime engine, using the default properties of the Velocity distribution |
static void |
init(java.util.Properties p)
initialize the Velocity runtime engine, using default properties plus the properties in the passed in java.util.Properties object |
static void |
init(java.lang.String propsFilename)
initialize the Velocity runtime engine, using default properties plus the properties in the properties file passed in as the arg |
static boolean |
invokeVelocimacro(java.lang.String vmName,
java.lang.String namespace,
java.lang.String[] params,
Context context,
java.io.Writer writer)
Invokes a currently registered Velocimacro with the parms provided and places the rendered stream into the writer. |
static boolean |
mergeTemplate(java.lang.String templateName,
Context context,
java.io.Writer writer)
merges a template and puts the rendered stream into the writer |
static void |
setConfiguration(Configuration configuration)
Set an entire configuration at once. |
static void |
setProperty(java.lang.String key,
java.lang.Object value)
Set a Velocity Runtime property. |
static boolean |
templateExists(java.lang.String templateName)
Determines if a template is accessable via the currently configured resource loaders. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public Velocity()
| Method Detail |
public static void init()
throws java.lang.Exception
public static void init(java.lang.String propsFilename)
throws java.lang.Exception
propsFilename - file containing properties to use to initialize
the Velocity runtime
public static void init(java.util.Properties p)
throws java.lang.Exception
p - Proprties object containing initialization properties
public static void setProperty(java.lang.String key,
java.lang.Object value)
String - keyObject - value
public static void addProperty(java.lang.String key,
java.lang.Object value)
String - keyObject - valuepublic static void clearProperty(java.lang.String key)
key - of property to clearpublic static void setConfiguration(Configuration configuration)
Configuration - configurationpublic static java.lang.Object getProperty(java.lang.String key)
key - property to retrieve
public static boolean evaluate(Context context,
java.io.Writer out,
java.lang.String logTag,
java.lang.String instring)
throws ParseErrorException,
MethodInvocationException,
java.io.IOException
context - context to use in rendering input stringout - Writer in which to render the outputlogTag - string to be used as the template name for log
messages in case of errorinstring - input string containing the VTL to be rendered
public static boolean evaluate(Context context,
java.io.Writer writer,
java.lang.String logTag,
java.io.InputStream instream)
throws ParseErrorException,
MethodInvocationException,
java.io.IOException
context - context to use in rendering input stringout - Writer in which to render the outputlogTag - string to be used as the template name for log messages
in case of errorinstream - input stream containing the VTL to be rendered
public static boolean invokeVelocimacro(java.lang.String vmName,
java.lang.String namespace,
java.lang.String[] params,
Context context,
java.io.Writer writer)
vmName - name of Velocimacro to callparams[] - args used to invoke Velocimacro. In context key format :
eg "foo","bar" (rather than "$foo","$bar")context - Context object containing data/objects used for rendering.writer - Writer for output stream
public static boolean mergeTemplate(java.lang.String templateName,
Context context,
java.io.Writer writer)
throws ResourceNotFoundException,
ParseErrorException,
MethodInvocationException,
java.lang.Exception
templateName - name of template to be used in mergecontext - filled context to be used in mergewriter - writer to write template into
public static Template getTemplate(java.lang.String name)
throws ResourceNotFoundException,
ParseErrorException,
java.lang.Exception
Template from the Velocity
resource management system.name - The file name of the desired template.ResourceNotFoundException - if template not found
from any available source.ParseErrorException - if template cannot be parsed due
to syntax (or other) error.java.lang.Exception - if an error occurs in template initializationpublic static boolean templateExists(java.lang.String templateName)
templateName - name of the temlpate to search for
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||