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, initRequest, manageResourceNotFound, mergeTemplate, requestCleanup, setVelocityView
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
protected 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.Servlet
init
in class org.apache.velocity.tools.view.VelocityViewServlet
config
- servlet configurationjavax.servlet.ServletException
public 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.VelocityViewServlet
protected 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.VelocityViewServlet
request
- 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.VelocityViewServlet
request
- servlet request from clientresponse
- servlet reponse to clientCopyright © 2000–2020 Apache Software Foundation. All rights reserved.