|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.apache.velocity.tools.view.servlet.VelocityViewServlet
org.apache.velocity.tools.view.servlet.VelocityLayoutServlet
public class VelocityLayoutServlet
Extension of the VelocityViewServlet to perform "two-pass" layout rendering and allow for a customized error screen. For a brief user-guide to this, i suggest trying to track down the VLS_README.txt file that hopefully made it into the docs somewhere.
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_DEFAULT_LAYOUT
The default filename for the servlet's default layout |
static java.lang.String |
DEFAULT_ERROR_TEMPLATE
The default error template's filename. |
static java.lang.String |
DEFAULT_LAYOUT_DIR
The default layout directory |
protected java.lang.String |
defaultLayout
|
protected java.lang.String |
errorTemplate
|
static java.lang.String |
KEY_ERROR_CAUSE
The context key that holds the Throwable that
broke the rendering of the requested screen. |
static java.lang.String |
KEY_ERROR_INVOCATION_EXCEPTION
The context key that holds the MethodInvocationException
that broke the rendering of the requested screen. |
static java.lang.String |
KEY_ERROR_STACKTRACE
The context key that holds the stack trace of the error that broke the rendering of the requested screen. |
static java.lang.String |
KEY_LAYOUT
The context/parameter key used to specify an alternate layout to be used for a request instead of the default layout. |
static java.lang.String |
KEY_SCREEN_CONTENT
The context key that will hold the content of the screen. |
protected java.lang.String |
layoutDir
|
static java.lang.String |
PROPERTY_DEFAULT_LAYOUT
The velocity.properties key for specifying the servlet's default layout template's filename. |
static java.lang.String |
PROPERTY_ERROR_TEMPLATE
The velocity.properties key for specifying the servlet's error template. |
static java.lang.String |
PROPERTY_LAYOUT_DIR
The velocity.properties key for specifying the relative directory holding layout templates. |
private static long |
serialVersionUID
serial version id |
private org.apache.velocity.app.VelocityEngine |
velocity
|
| 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 | |
|---|---|
VelocityLayoutServlet()
|
|
| Method Summary | |
|---|---|
protected org.apache.velocity.context.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Overrides VelocityViewServlet to check the request for an alternate layout |
protected void |
error(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Exception e)
Overrides VelocityViewServlet to display user's custom error template |
void |
init(javax.servlet.ServletConfig config)
Initializes Velocity, the view servlet and checks for changes to the initial layout configuration. |
protected void |
mergeTemplate(org.apache.velocity.Template template,
org.apache.velocity.context.Context context,
javax.servlet.http.HttpServletResponse response)
Overrides VelocityViewServlet.mergeTemplate to do a two-pass render for handling layouts |
| Methods inherited from class org.apache.velocity.tools.view.servlet.VelocityViewServlet |
|---|
doGet, doPost, doRequest, fillContext, findInitParameter, getResponseWriter, getTemplate, getTemplate, getTemplate, getTemplate, getVelocityEngine, getVelocityProperty, handleRequest, initToolbox, initVelocity, loadConfiguration, 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 |
| Field Detail |
|---|
private static final long serialVersionUID
public static final java.lang.String PROPERTY_ERROR_TEMPLATE
public static final java.lang.String PROPERTY_LAYOUT_DIR
public static final java.lang.String PROPERTY_DEFAULT_LAYOUT
public static java.lang.String DEFAULT_ERROR_TEMPLATE
public static java.lang.String DEFAULT_LAYOUT_DIR
public static java.lang.String DEFAULT_DEFAULT_LAYOUT
public static java.lang.String KEY_SCREEN_CONTENT
public static java.lang.String KEY_LAYOUT
public static java.lang.String KEY_ERROR_CAUSE
Throwable that
broke the rendering of the requested screen.
public static java.lang.String KEY_ERROR_STACKTRACE
public static java.lang.String KEY_ERROR_INVOCATION_EXCEPTION
MethodInvocationException
that broke the rendering of the requested screen.
If this value is placed in the context, then $error_cause
will hold the error that this invocation exception is wrapping.
protected java.lang.String errorTemplate
protected java.lang.String layoutDir
protected java.lang.String defaultLayout
private org.apache.velocity.app.VelocityEngine velocity
| Constructor Detail |
|---|
public VelocityLayoutServlet()
| Method Detail |
|---|
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
init in interface javax.servlet.Servletinit in class VelocityViewServletconfig - servlet configuration parameters
javax.servlet.ServletException
protected org.apache.velocity.context.Context createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
createContext in class VelocityViewServletrequest - client requestresponse - client response
protected void mergeTemplate(org.apache.velocity.Template template,
org.apache.velocity.context.Context context,
javax.servlet.http.HttpServletResponse response)
throws org.apache.velocity.exception.ResourceNotFoundException,
org.apache.velocity.exception.ParseErrorException,
org.apache.velocity.exception.MethodInvocationException,
java.io.IOException,
java.io.UnsupportedEncodingException,
java.lang.Exception
mergeTemplate in class VelocityViewServlettemplate - template object returned by the handleRequest() methodcontext - Context created by the VelocityViewServlet.createContext(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)response - servlet reponse (used to get a Writer)
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException
java.io.IOException
java.io.UnsupportedEncodingException
java.lang.Exception
protected void error(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.Exception e)
throws javax.servlet.ServletException
error in class VelocityViewServletrequest - original HttpServletRequest from servlet container.response - HttpServletResponse object from servlet container.e - Exception that was thrown by some other part of process.
javax.servlet.ServletException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||