org.activemath.webapp.base
Class VelocityViewServlet

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.activemath.webapp.base.VelocityViewServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig, org.apache.velocity.app.event.EventHandler, org.apache.velocity.app.event.MethodExceptionEventHandler

public class VelocityViewServlet
extends org.apache.velocity.tools.view.servlet.VelocityViewServlet
implements org.apache.velocity.app.event.MethodExceptionEventHandler

ActiveMath's VelocityViewServlet Overrides default behavior of @see org.apache.velocity.tools.view.servlet.VelocityViewServlet to suite ActiveMath (see handleRequest(HttpServletRequest, HttpServletResponse, Context)). This servlet makes use of @see org.apache.velocity.tools.view.context.ChainedContext, which provides the following special features:

See Also:
Serialized Form

Field Summary
protected  String defaultLanguage
          The two character abbreviation for the request's default language.
protected static Category log
          The logger for this class
 
Fields inherited from class org.apache.velocity.tools.view.servlet.VelocityViewServlet
CONTENT_TYPE, DEFAULT_CONTENT_TYPE, DEFAULT_OUTPUT_ENCODING, INIT_PROPS_KEY, SERVLET_CONTEXT_KEY, TOOLBOX_KEY
 
Constructor Summary
VelocityViewServlet()
           
 
Method Summary
protected  void error(HttpServletRequest request, HttpServletResponse response, Exception cause)
           
protected  org.apache.velocity.Template handleRequest(HttpServletRequest request, HttpServletResponse response, org.apache.velocity.context.Context ctx)
          Handle the template processing request.
protected  void mergeTemplate(org.apache.velocity.Template template, org.apache.velocity.context.Context ctx, HttpServletResponse response)
          Merges the template with the context.
 Object methodException(Class claz, String method, Exception e)
          Event handler for catching Velocity exceptions
 
Methods inherited from class org.apache.velocity.tools.view.servlet.VelocityViewServlet
createContext, doGet, doPost, doRequest, getTemplate, getTemplate, init, initToolbox, initVelocity, loadConfiguration, requestCleanup, setContentType
 
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
 

Field Detail

log

protected static Category log
The logger for this class


defaultLanguage

protected String defaultLanguage
The two character abbreviation for the request's default language.

Constructor Detail

VelocityViewServlet

public VelocityViewServlet()
Method Detail

mergeTemplate

protected void mergeTemplate(org.apache.velocity.Template template,
                             org.apache.velocity.context.Context ctx,
                             HttpServletResponse response)
                      throws org.apache.velocity.exception.ResourceNotFoundException,
                             org.apache.velocity.exception.ParseErrorException,
                             org.apache.velocity.exception.MethodInvocationException,
                             IOException,
                             UnsupportedEncodingException,
                             Exception
Merges the template with the context. Work on the response's writer instead of output stream.

Overrides:
mergeTemplate in class org.apache.velocity.tools.view.servlet.VelocityViewServlet
Throws:
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException
IOException
UnsupportedEncodingException
Exception
See Also:
VelocityViewServlet.mergeTemplate(org.apache.velocity.Template, org.apache.velocity.context.Context, javax.servlet.http.HttpServletResponse)

handleRequest

protected org.apache.velocity.Template handleRequest(HttpServletRequest request,
                                                     HttpServletResponse response,
                                                     org.apache.velocity.context.Context ctx)
                                              throws Exception

Handle the template processing request.

Changes for ActiveMath:

Overrides:
handleRequest in class org.apache.velocity.tools.view.servlet.VelocityViewServlet
Parameters:
request - client request
response - client response
ctx - VelocityContext to fill
Returns:
Velocity Template object or null
Throws:
Exception

methodException

public Object methodException(Class claz,
                              String method,
                              Exception e)
                       throws Exception
Event handler for catching Velocity exceptions

Specified by:
methodException in interface org.apache.velocity.app.event.MethodExceptionEventHandler
Throws:
Exception

error

protected void error(HttpServletRequest request,
                     HttpServletResponse response,
                     Exception cause)
              throws IOException
Overrides:
error in class org.apache.velocity.tools.view.servlet.VelocityViewServlet
Throws:
IOException