Package org.sakaiproject.vm
Class VelocityServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.apache.velocity.tools.view.servlet.VelocityViewServlet
-
- org.sakaiproject.vm.VelocityServlet
-
- All Implemented Interfaces:
Serializable,Servlet,ServletConfig
public class VelocityServlet extends org.apache.velocity.tools.view.servlet.VelocityViewServletResponds with the expansion of a Velocity Template. The template and context references are specified in the request.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description VelocityServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringescapeVmName(String name)Change any characters that Velocity doesn't like in the name to '_' to make a valid Velocity nameorg.apache.velocity.TemplatehandleRequest(HttpServletRequest request, HttpServletResponse response, org.apache.velocity.context.Context ctx)main routine to handle a request.protected org.apache.commons.collections.ExtendedPropertiesloadConfiguration(ServletConfig config)Called by the VelocityServlet init().-
Methods inherited from class org.apache.velocity.tools.view.servlet.VelocityViewServlet
createContext, doGet, doPost, doRequest, error, fillContext, findInitParameter, getResponseWriter, getTemplate, getTemplate, getTemplate, getTemplate, getVelocityEngine, getVelocityProperty, init, initToolbox, initVelocity, mergeTemplate, performMerge, requestCleanup, setContentType, setVelocityEngine
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
-
-
-
Method Detail
-
loadConfiguration
protected org.apache.commons.collections.ExtendedProperties loadConfiguration(ServletConfig config) throws IOException, FileNotFoundException
Called by the VelocityServlet init(). We want to set a set of properties so that templates will be found in the webapp root. This makes this easier to work with as an example, so a new user doesn't have to worry about config issues when first figuring things out- Overrides:
loadConfigurationin classorg.apache.velocity.tools.view.servlet.VelocityViewServlet- Throws:
IOExceptionFileNotFoundException
-
handleRequest
public org.apache.velocity.Template handleRequest(HttpServletRequest request, HttpServletResponse response, org.apache.velocity.context.Context ctx)
main routine to handle a request. Called by VelocityServlet, your responsibility as programmer is to simply return a valid Template
- Overrides:
handleRequestin classorg.apache.velocity.tools.view.servlet.VelocityViewServlet- Parameters:
ctx- a Velocity Context object to be filled with data. Will be used for rendering this template- Returns:
- Template to be used for request
-
-