Interface VelocityService
-
- All Known Implementing Classes:
TurbineVelocityService
public interface VelocityService extends Service
Implementations of the VelocityService interface.- Version:
- $Id$
- Author:
- John D. McNally, Dave Bryson, Jason van Zyl, Henning P. Schmiedehausen, Peter Courcoux
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
CATCH_ERRORS_DEFAULT
Default: Yesstatic String
CATCH_ERRORS_KEY
Shall we catch Velocity Errors and report them?static String
CONTEXT
Key for storing the Context in the RunData objectstatic String
PIPELINEDATA_KEY
The Key for storing the PipelineData Object in the Contextstatic String
RUNDATA_KEY
The Key for storing the RunData Object in the Contextstatic String
SERVICE_NAME
The Service Namestatic String
VELOCITY_EXTENSION
The default extension of Velocity Pages
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description org.apache.velocity.context.Context
getContext()
Create an empty WebContext object.org.apache.velocity.context.Context
getContext(PipelineData pipelineData)
Create a Context from the PipelineData object.org.apache.velocity.context.Context
getNewContext()
This method returns a new, empty Context object.String
handleRequest(org.apache.velocity.context.Context context, String template)
Process the request and fill in the template with the values you set in the Context.void
handleRequest(org.apache.velocity.context.Context context, String filename, OutputStream out)
Process the request and fill in the template with the values you set in the Context.void
handleRequest(org.apache.velocity.context.Context context, String filename, Writer writer)
Process the request and fill in the template with the values you set in the Context.void
requestFinished(org.apache.velocity.context.Context context)
Performs post-request actions (releases context tools back to the object pool).-
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
-
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
-
-
-
-
Field Detail
-
SERVICE_NAME
static final String SERVICE_NAME
The Service Name- See Also:
- Constant Field Values
-
CONTEXT
static final String CONTEXT
Key for storing the Context in the RunData object- See Also:
- Constant Field Values
-
VELOCITY_EXTENSION
static final String VELOCITY_EXTENSION
The default extension of Velocity Pages- See Also:
- Constant Field Values
-
RUNDATA_KEY
static final String RUNDATA_KEY
The Key for storing the RunData Object in the Context- See Also:
- Constant Field Values
-
PIPELINEDATA_KEY
static final String PIPELINEDATA_KEY
The Key for storing the PipelineData Object in the Context- See Also:
- Constant Field Values
-
CATCH_ERRORS_KEY
static final String CATCH_ERRORS_KEY
Shall we catch Velocity Errors and report them?- See Also:
- Constant Field Values
-
CATCH_ERRORS_DEFAULT
static final boolean CATCH_ERRORS_DEFAULT
Default: Yes- See Also:
- Constant Field Values
-
-
Method Detail
-
handleRequest
String handleRequest(org.apache.velocity.context.Context context, String template) throws Exception
Process the request and fill in the template with the values you set in the Context.- Parameters:
context
- A Context.template
- A String with the filename of the template.- Returns:
- The process template as a String.
- Throws:
Exception
- a generic exception.
-
handleRequest
void handleRequest(org.apache.velocity.context.Context context, String filename, OutputStream out) throws TurbineException
Process the request and fill in the template with the values you set in the Context.- Parameters:
context
- A Context.filename
- A String with the filename of the template.out
- A OutputStream where we will write the process template as a String.- Throws:
TurbineException
- Any exception thrown while processing will be wrapped into a TurbineException and rethrown.
-
handleRequest
void handleRequest(org.apache.velocity.context.Context context, String filename, Writer writer) throws TurbineException
Process the request and fill in the template with the values you set in the Context.- Parameters:
context
- A Context.filename
- A String with the filename of the template.writer
- A Writer where we will write the process template as a String.- Throws:
TurbineException
- Any exception thrown while processing will be wrapped into a TurbineException and rethrown.
-
getContext
org.apache.velocity.context.Context getContext()
Create an empty WebContext object.- Returns:
- An empty WebContext object.
-
getNewContext
org.apache.velocity.context.Context getNewContext()
This method returns a new, empty Context object.- Returns:
- A WebContext.
-
getContext
org.apache.velocity.context.Context getContext(PipelineData pipelineData)
Create a Context from the PipelineData object. Adds a pointer to the PipelineData object to the Context so that PipelineData is available in the templates.- Parameters:
pipelineData
- The Turbine PipelineData object.- Returns:
- A clone of the Context needed by Velocity.
-
requestFinished
void requestFinished(org.apache.velocity.context.Context context)
Performs post-request actions (releases context tools back to the object pool).- Parameters:
context
- a Velocity Context
-
-