|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.fulcrum.BaseService
org.apache.fulcrum.template.BaseTemplateEngineService
org.tigris.scarab.services.email.VelocityEmailService
This is a Service that can process Velocity templates from within a
Turbine Screen. Here's an example of how you might use it from a
screen:
Character sets map codes to glyphs, while encodings map between
chars/bytes and codes.
bytes -> [encoding] -> charset -> [rendering] -> glyphs
Context context = new VelocityContext();
context.put("message", "Hello from Turbine!");
String results = TurbineVelocity.handleRequest(context,"HelloWorld.vm");
This copy of TurbineVelocityService has been slightly modified from its original form to support toggling of Scarab's cross-site scripting filter.
| Field Summary |
| Fields inherited from class org.apache.fulcrum.BaseService |
isInitialized, name, serviceBroker |
| Fields inherited from interface org.tigris.scarab.services.email.EmailService |
SERVICE_NAME |
| Fields inherited from interface org.apache.fulcrum.template.TemplateEngineService |
DEFAULT_LAYOUT_TEMPLATE, DEFAULT_PAGE_TEMPLATE, DEFAULT_TEMPLATE_EXTENSION, TEMPLATE_EXTENSIONS |
| Constructor Summary | |
VelocityEmailService()
|
|
| Method Summary | |
java.lang.String |
handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename)
Process the request and fill in the template using the values set in context. |
void |
handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.io.OutputStream output)
Process the request and fill in the template using the values set in context. |
void |
handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.io.OutputStream output,
java.lang.String charset,
java.lang.String encoding)
Process the request and fill in the template using the values set in context. |
java.lang.String |
handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.lang.String charset,
java.lang.String encoding)
Process the request and fill in the template using the values set in 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 using the values set in context. |
void |
handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.io.Writer writer,
java.lang.String encoding)
Process the request and fill in the template using the values set in context. |
java.lang.String |
handleRequest(org.apache.fulcrum.template.TemplateContext context,
java.lang.String template)
|
void |
handleRequest(org.apache.fulcrum.template.TemplateContext context,
java.lang.String template,
java.io.OutputStream outputStream)
|
void |
handleRequest(org.apache.fulcrum.template.TemplateContext context,
java.lang.String template,
java.io.Writer writer)
|
void |
init()
Performs early initialization of this Turbine service. |
boolean |
templateExists(java.lang.String template)
Find out if a given template exists. |
| Methods inherited from class org.apache.fulcrum.template.BaseTemplateEngineService |
getAssociatedFileExtensions, getTemplateEngineServiceConfiguration, initConfiguration, registerConfiguration |
| Methods inherited from class org.apache.fulcrum.BaseService |
getCategory, getConfiguration, getInit, getName, getRealPath, getServiceBroker, getServiceObject, getStatus, isInitialized, setInit, setName, setServiceBroker, shutdown |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.fulcrum.Service |
getCategory, getConfiguration, getRealPath, getStatus, isInitialized, setName, setServiceBroker, shutdown |
| Constructor Detail |
public VelocityEmailService()
| Method Detail |
public void init()
throws org.apache.fulcrum.InitializationException
init in interface org.apache.fulcrum.Serviceorg.apache.fulcrum.InitializationException
public java.lang.String handleRequest(org.apache.fulcrum.template.TemplateContext context,
java.lang.String template)
throws org.apache.fulcrum.ServiceException
handleRequest in interface org.apache.fulcrum.template.TemplateEngineServiceorg.apache.fulcrum.ServiceExceptionVelocityService
public java.lang.String handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename)
throws org.apache.fulcrum.ServiceException
EmailServicecontext.
handleRequest in interface EmailServicecontext - A context to use when evaluating the specified
template.filename - The file name of the template.
org.apache.fulcrum.ServiceExceptionVelocityService
public java.lang.String handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.lang.String charset,
java.lang.String encoding)
throws org.apache.fulcrum.ServiceException
EmailServicecontext.
handleRequest in interface EmailServicecontext - A context to use when evaluating the specified
template.charset - The character set to use when writing the result.encoding - The encoding to use when merging context and
template.
org.apache.fulcrum.ServiceExceptionVelocityService
public void handleRequest(org.apache.fulcrum.template.TemplateContext context,
java.lang.String template,
java.io.OutputStream outputStream)
throws org.apache.fulcrum.ServiceException
handleRequest in interface org.apache.fulcrum.template.TemplateEngineServiceorg.apache.fulcrum.ServiceExceptionTemplateEngineService
public void handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.io.OutputStream output)
throws org.apache.fulcrum.ServiceException
EmailServicecontext.
handleRequest in interface EmailServicecontext - A context to use when evaluating the specified
template.filename - The file name of the template.output - The stream to which we will write the processed
template as a String.
org.apache.fulcrum.ServiceException - Any exception trown while processing will be
wrapped into a ServiceException and rethrown.VelocityService
public void handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.io.OutputStream output,
java.lang.String charset,
java.lang.String encoding)
throws org.apache.fulcrum.ServiceException
EmailServicecontext.
handleRequest in interface EmailServicecontext - A context to use when evaluating the specified
template.filename - The file name of the template.output - The stream to which we will write the processed
template as a String.charset - The character set to use when writing the result.encoding - The encoding to use when merging context and
template.
org.apache.fulcrum.ServiceException - Any exception trown while processing will be
wrapped into a ServiceException and rethrown.VelocityService
public void handleRequest(org.apache.fulcrum.template.TemplateContext context,
java.lang.String template,
java.io.Writer writer)
throws org.apache.fulcrum.ServiceException
handleRequest in interface org.apache.fulcrum.template.TemplateEngineServiceorg.apache.fulcrum.ServiceExceptionBaseTemplateEngineService.handleRequest(TemplateContext, String, Writer)
public void handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.io.Writer writer)
throws org.apache.fulcrum.ServiceException
EmailServicecontext.
handleRequest in interface EmailServicecontext - A context to use when evaluating the specified
template.filename - The file name of the template.writer - The writer to which we will write the processed template.
org.apache.fulcrum.ServiceException - Any exception trown while processing will be
wrapped into a ServiceException and rethrown.handleRequest(Context, String, Writer)
public void handleRequest(org.apache.velocity.context.Context context,
java.lang.String filename,
java.io.Writer writer,
java.lang.String encoding)
throws org.apache.fulcrum.ServiceException
EmailServicecontext.
handleRequest in interface EmailServicecontext - A context to use when evaluating the specified
template.filename - The file name of the template.writer - The writer to which we will write the processed template.encoding - The encoding to use when merging context and
template.
org.apache.fulcrum.ServiceException - Any exception trown while processing will be
wrapped into a ServiceException and rethrown.handleRequest(Context, String, Writer, String)public boolean templateExists(java.lang.String template)
templateExists in interface org.apache.fulcrum.template.TemplateEngineService
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||