public abstract class TurbineVelocity extends Object
Context context = TurbineVelocity.getContext(data); context.put("message", "Hello from Turbine!"); String results = TurbineVelocity.handleRequest(context, "helloWorld.vm"); data.getPage().getBody().addElement(results);
Constructor and Description |
---|
TurbineVelocity() |
Modifier and Type | Method and Description |
---|---|
static org.apache.velocity.context.Context |
getContext()
This method returns a blank Context object, which
also contains the global context object.
|
static org.apache.velocity.context.Context |
getContext(PipelineData pipelineData)
This returns a Context that you can pass into handleRequest
once you have populated it with information that the template
will know about.
|
static org.apache.velocity.context.Context |
getNewContext()
This method returns a new, empty Context object.
|
static VelocityService |
getService()
Utility method for accessing the service
implementation
|
static String |
handleRequest(org.apache.velocity.context.Context context,
String template)
This allows you to pass in a context and a path to a template
file and then grabs an instance of the velocity service and
processes the template and returns the results as a String
object.
|
static void |
handleRequest(org.apache.velocity.context.Context context,
String template,
OutputStream out)
Process the request and fill in the template with the values
you set in the Context.
|
static void |
handleRequest(org.apache.velocity.context.Context context,
String template,
Writer writer)
Process the request and fill in the template with the values
you set in the Context.
|
static void |
requestFinished(org.apache.velocity.context.Context context)
Performs post-request actions (releases context
tools back to the object pool).
|
public TurbineVelocity()
public static VelocityService getService()
public static String handleRequest(org.apache.velocity.context.Context context, String template) throws Exception
context
- A Context.template
- The path for the template files.Exception
- a generic exception.public static void handleRequest(org.apache.velocity.context.Context context, String template, OutputStream out) throws Exception
context
- A Context.template
- A String with the filename of the template.out
- A OutputStream where we will write the process template as
a String.Exception
- a generic exception.public static void handleRequest(org.apache.velocity.context.Context context, String template, Writer writer) throws Exception
context
- A Context.template
- A String with the filename of the template.writer
- A Writer where we will write the process template as
a String.Exception
- a generic exception.public static org.apache.velocity.context.Context getContext(PipelineData pipelineData)
pipelineData
- A Turbine PipelineData.public static org.apache.velocity.context.Context getContext()
public static org.apache.velocity.context.Context getNewContext()
public static void requestFinished(org.apache.velocity.context.Context context)
context
- a Velocity ContextCopyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.