org.sakaiproject.vm
Class VelocityServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.velocity.tools.view.servlet.VelocityViewServlet
              extended by org.sakaiproject.vm.VelocityServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class VelocityServlet
extends org.apache.velocity.tools.view.servlet.VelocityViewServlet

Responds with the expansion of a Velocity Template. The template and context references are specified in the request.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.velocity.tools.view.servlet.VelocityViewServlet
CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, DEFAULT_PROPERTIES_PATH, DEFAULT_TOOLBOX_PATH, DEFAULT_TOOLS_PROPERTIES, INIT_PROPS_KEY, SERVLET_CONTEXT_KEY, TOOLBOX_KEY, toolboxManager
 
Constructor Summary
VelocityServlet()
           
 
Method Summary
protected  String escapeVmName(String name)
          Change any characters that Velocity doesn't like in the name to '_' to make a valid Velocity name
 org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.velocity.context.Context ctx)
           main routine to handle a request.
protected  org.apache.commons.collections.ExtendedProperties loadConfiguration(javax.servlet.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VelocityServlet

public VelocityServlet()
Method Detail

loadConfiguration

protected org.apache.commons.collections.ExtendedProperties loadConfiguration(javax.servlet.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:
loadConfiguration in class org.apache.velocity.tools.view.servlet.VelocityViewServlet
Throws:
IOException
FileNotFoundException

handleRequest

public org.apache.velocity.Template handleRequest(javax.servlet.http.HttpServletRequest request,
                                                  javax.servlet.http.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:
handleRequest in class org.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

escapeVmName

protected String escapeVmName(String name)
Change any characters that Velocity doesn't like in the name to '_' to make a valid Velocity name

Parameters:
name - The name to convert.
Returns:
The name converted to a valid Velocity name.


Copyright © 2003-2013 The Sakai Foundation. All Rights Reserved.