org.apache.turbine.services.velocity
Interface VelocityService

All Superinterfaces:
Initable, Service
All Known Implementing Classes:
TurbineVelocityService

public interface VelocityService
extends Service

Implementations of the VelocityService interface.

Version:
$Id: VelocityService.java 534527 2007-05-02 16:10:59Z tv $
Author:
John D. McNally, Dave Bryson, Jason van Zyl, Henning P. Schmiedehausen

Field Summary
static boolean CATCH_ERRORS_DEFAULT
          Default: Yes
static java.lang.String CATCH_ERRORS_KEY
          Shall we catch Velocity Errors and report them?
static java.lang.String CONTEXT
          Key for storing the Context in the RunData object
static java.lang.String RUNDATA_KEY
          The Key for storing the RunData Object in the Context
static java.lang.String SERVICE_NAME
          The Service Name
static java.lang.String VELOCITY_EXTENSION
          The default extension of Velocity Pages
 
Method Summary
 org.apache.velocity.context.Context getContext()
          Create an empty WebContext object.
 org.apache.velocity.context.Context getContext(RunData data)
          Create a Context from the RunData object.
 org.apache.velocity.context.Context getNewContext()
          This method returns a new, empty Context object.
 java.lang.String handleRequest(org.apache.velocity.context.Context context, java.lang.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, java.lang.String filename, java.io.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, java.lang.String filename, java.io.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.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
The Service Name

See Also:
Constant Field Values

CONTEXT

public static final java.lang.String CONTEXT
Key for storing the Context in the RunData object

See Also:
Constant Field Values

VELOCITY_EXTENSION

public static final java.lang.String VELOCITY_EXTENSION
The default extension of Velocity Pages

See Also:
Constant Field Values

RUNDATA_KEY

public static final java.lang.String RUNDATA_KEY
The Key for storing the RunData Object in the Context

See Also:
Constant Field Values

CATCH_ERRORS_KEY

public static final java.lang.String CATCH_ERRORS_KEY
Shall we catch Velocity Errors and report them?

See Also:
Constant Field Values

CATCH_ERRORS_DEFAULT

public static final boolean CATCH_ERRORS_DEFAULT
Default: Yes

See Also:
Constant Field Values
Method Detail

handleRequest

public java.lang.String handleRequest(org.apache.velocity.context.Context context,
                                      java.lang.String template)
                               throws java.lang.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:
java.lang.Exception - a generic exception.

handleRequest

public void handleRequest(org.apache.velocity.context.Context context,
                          java.lang.String filename,
                          java.io.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 trown while processing will be wrapped into a TurbineException and rethrown.

handleRequest

public void handleRequest(org.apache.velocity.context.Context context,
                          java.lang.String filename,
                          java.io.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 trown while processing will be wrapped into a TurbineException and rethrown.

getContext

public org.apache.velocity.context.Context getContext()
Create an empty WebContext object.

Returns:
An empty WebContext object.

getNewContext

public org.apache.velocity.context.Context getNewContext()
This method returns a new, empty Context object.

Returns:
A WebContext.

getContext

public org.apache.velocity.context.Context getContext(RunData data)
Create a Context from the RunData object. Adds a pointer to the RunData object to the Context so that RunData is available in the templates.

Parameters:
data - The Turbine RunData object.
Returns:
A clone of the Context needed by Velocity.

requestFinished

public 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


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.