org.activemath.webapp.base
Class VelocityViewServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.velocity.tools.view.servlet.VelocityViewServlet
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:
- puts the request, response, session, and servlet context objects
into the Velocity context for direct access, and keeps them
read-only
- supports a read-only toolbox of view tools
- auto-searches servlet request attributes, session attributes and
servlet context attribues for objects
- 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 |
| 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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
protected static Category log
- The logger for this class
defaultLanguage
protected String defaultLanguage
- The two character abbreviation for the request's default
language.
VelocityViewServlet
public VelocityViewServlet()
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:
- make model objects available without $model
- make a LinkTool available as $link
- set $appRoot and $vmRoot
- select localized template ("register_de.vm")
- Overrides:
handleRequest in class org.apache.velocity.tools.view.servlet.VelocityViewServlet
- Parameters:
request - client requestresponse - client responsectx - 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