@Override
protected Context createVelocityContext(
Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
// Create a ChainedContext instance.
ChainedContext velocityContext = new ChainedContext(
new VelocityContext(model), getVelocityEngine(), request, response, getServletContext());
// Load a Velocity Tools toolbox, if necessary.
if (getToolboxConfigLocation() != null) {
ToolboxManager toolboxManager = ServletToolboxManager.getInstance(
getServletContext(), getToolboxConfigLocation());
Map toolboxContext = toolboxManager.getToolbox(velocityContext);
velocityContext.setToolbox(toolboxContext);
}
return velocityContext;
}