public class VelocityDecoratorServlet
extends org.apache.velocity.tools.view.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, fillContext, findInitParameter, getLog, getTemplate, getTemplate, getVelocityProperty, getVelocityView, manageResourceNotFound, mergeTemplate, requestCleanup, setVelocityViewdoDelete, 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.VelocityViewServletconfig - servlet configurationjavax.servlet.ServletExceptionpublic org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.apache.velocity.context.Context context)
handleRequest in class org.apache.velocity.tools.view.VelocityViewServletprotected 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.VelocityViewServletrequest - servlet request from clientresponse - servlet reponse to clientprotected void setContentType(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Sets the content type of the response. This is available to be overridden by a derived class.
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.VelocityViewServletrequest - servlet request from clientresponse - servlet reponse to clientCopyright © 2000–2023 Apache Software Foundation. All rights reserved.