public class VelocityLayoutServlet extends VelocityViewServlet
| Modifier and Type | Field and Description |
|---|---|
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
|
BUFFER_OUTPUT_PARAM| Constructor and Description |
|---|
VelocityLayoutServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
error(HttpServletRequest request,
HttpServletResponse response,
java.lang.Throwable e)
Overrides VelocityViewServlet to display user's custom error template
|
protected void |
fillContext(Context ctx,
HttpServletRequest request)
Overrides VelocityViewServlet to check the request for
an alternate layout
|
protected java.lang.String |
findLayout(HttpServletRequest request)
Searches for a non-default layout to be used for this request.
|
void |
init(ServletConfig config)
Initializes Velocity, the view servlet and checks for changes to
the initial layout configuration.
|
protected void |
mergeTemplate(Template template,
Context context,
HttpServletResponse response)
Overrides VelocityViewServlet.mergeTemplate to do a two-pass
render for handling layouts
|
createContext, doGet, doPost, doRequest, findInitParameter, getLog, getTemplate, getTemplate, getVelocityProperty, getVelocityView, handleRequest, manageResourceNotFound, requestCleanup, setContentType, setVelocityViewprivate 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 final java.lang.String DEFAULT_ERROR_TEMPLATE
public static final java.lang.String DEFAULT_LAYOUT_DIR
public static final java.lang.String DEFAULT_DEFAULT_LAYOUT
public static final java.lang.String KEY_SCREEN_CONTENT
public static final java.lang.String KEY_LAYOUT
public static final java.lang.String KEY_ERROR_CAUSE
Throwable that
broke the rendering of the requested screen.public static final java.lang.String KEY_ERROR_STACKTRACE
public static final 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
public void init(ServletConfig config)
throws ServletException
init in class VelocityViewServletconfig - servlet configuration parametersServletExceptionprotected void fillContext(Context ctx,
HttpServletRequest request)
fillContext in class VelocityViewServletctx - context for this requestrequest - client requestprotected java.lang.String findLayout(HttpServletRequest request)
protected void mergeTemplate(Template template,
Context context,
HttpServletResponse response)
throws java.io.IOException
mergeTemplate in class VelocityViewServletjava.io.IOExceptionprotected void error(HttpServletRequest request,
HttpServletResponse response,
java.lang.Throwable e)
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.Copyright (c) 2003-2007 Apache Software Foundation