public class VelocityDecoratorServlet
extends org.apache.velocity.tools.view.servlet.VelocityViewServlet
This is a SiteMesh Velocity view servlet.
It overrides the SiteMesh servlet to rely on the Velocity Manager in Struts instead of creating it's own manager
| Modifier and Type | Field and Description |
|---|---|
protected String |
defaultContentType |
protected VelocityManager |
velocityManager |
| Constructor and Description |
|---|
VelocityDecoratorServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.velocity.context.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates and returns an initialized Velocity context.
|
org.apache.velocity.Template |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.velocity.context.Context context) |
void |
init(javax.servlet.ServletConfig config)
Initializes servlet, toolbox and Velocity template engine.
|
protected void |
setContentType(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sets the content type of the response.
|
doGet, doPost, doRequest, error, findInitParameter, getResponseWriter, getTemplate, getTemplate, getVelocityEngine, getVelocityProperty, initToolbox, initVelocity, loadConfiguration, mergeTemplate, performMerge, requestCleanup, setVelocityEnginedoDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceprotected VelocityManager velocityManager
protected String defaultContentType
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
Initializes servlet, toolbox and Velocity template engine. Called by the servlet container on loading.
NOTE: If no charset is specified in the default.contentType property (in your velocity.properties) and you have specified an output.encoding property, then that will be used as the charset for the default content-type of pages served by this servlet.
init in interface javax.servlet.Servletinit in class org.apache.velocity.tools.view.servlet.VelocityViewServletconfig - servlet configuationjavax.servlet.ServletExceptionpublic org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.velocity.context.Context context)
throws Exception
handleRequest in class org.apache.velocity.tools.view.servlet.VelocityViewServletExceptionprotected org.apache.velocity.context.Context createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates and returns an initialized Velocity context.
createContext in class org.apache.velocity.tools.view.servlet.VelocityViewServletrequest - servlet request from clientresponse - servlet reponse to clientprotected void setContentType(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
The default implementation is :
response.setContentType(defaultContentType);
where defaultContentType is set to the value of the default.contentType
property, or "text/html" if that is not set.setContentType in class org.apache.velocity.tools.view.servlet.VelocityViewServletrequest - servlet request from clientresponse - servlet reponse to clientCopyright © 2000-2013 Apache Software Foundation. All Rights Reserved.