| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.turbine.services.velocity.TurbineVelocity
This is a simple static accessor to common Velocity tasks such as getting an instance of a context as well as handling a request for processing a template.
 Context context = TurbineVelocity.getContext(data);
 context.put("message", "Hello from Turbine!");
 String results = TurbineVelocity.handleRequest(context, "helloWorld.vm");
 data.getPage().getBody().addElement(results);
 
| Constructor Summary | |
| TurbineVelocity() | |
| Method Summary | |
| 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(RunData data)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 java.lang.String | handleRequest(org.apache.velocity.context.Context context,
              java.lang.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,
              java.lang.String template,
              java.io.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,
              java.lang.String template,
              java.io.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). | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
public TurbineVelocity()
| Method Detail | 
public static VelocityService getService()
public static java.lang.String handleRequest(org.apache.velocity.context.Context context,
                                             java.lang.String template)
                                      throws java.lang.Exception
context - A Context.template - The path for the template files.
java.lang.Exception - a generic exception.
public static void handleRequest(org.apache.velocity.context.Context context,
                                 java.lang.String template,
                                 java.io.OutputStream out)
                          throws java.lang.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.
java.lang.Exception - a generic exception.
public static void handleRequest(org.apache.velocity.context.Context context,
                                 java.lang.String template,
                                 java.io.Writer writer)
                          throws java.lang.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.
java.lang.Exception - a generic exception.public static org.apache.velocity.context.Context getContext(RunData data)
data - A Turbine RunData.
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 Context| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||