类 VelocityLayoutServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.velocity.tools.view.VelocityViewServlet
org.apache.velocity.tools.view.VelocityLayoutServlet
- 所有已实现的接口:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
Extension of the VelocityViewServlet to perform "two-pass"
layout rendering and allow for a customized error screen.
- 版本:
- $Id$
- 作者:
- Nathan Bubna
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明static final StringThe default filename for the servlet's default layoutstatic final StringThe default error template's filename.static final StringThe default layout directoryprotected Stringprotected Stringstatic final StringThe context key that holds theThrowablethat broke the rendering of the requested screen.static final StringThe context key that holds theMethodInvocationExceptionthat broke the rendering of the requested screen.static final StringThe context key that holds the stack trace of the error that broke the rendering of the requested screen.static final StringThe context/parameter key used to specify an alternate layout to be used for a request instead of the default layout.static final StringThe context key that will hold the content of the screen.protected Stringstatic final StringThe velocity.properties key for specifying the servlet's default layout template's filename.static final StringThe velocity.properties key for specifying whether dynamic layout change is allowedstatic final StringThe velocity.properties key for specifying the servlet's error template.static final StringThe velocity.properties key for specifying the relative directory holding layout templates.从类继承的字段 org.apache.velocity.tools.view.VelocityViewServlet
BUFFER_OUTPUT_PARAM从类继承的字段 jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected voiderror(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Throwable e) Overrides VelocityViewServlet to display user's custom error templateprotected voidfillContext(org.apache.velocity.context.Context ctx, jakarta.servlet.http.HttpServletRequest request) Overrides VelocityViewServlet to check the request for an alternate layoutprotected StringfindLayout(jakarta.servlet.http.HttpServletRequest request) Searches for a non-default layout to be used for this request.voidinit(jakarta.servlet.ServletConfig config) Initializes Velocity, the view servlet and checks for changes to the initial layout configuration.protected voidmergeTemplate(org.apache.velocity.Template template, org.apache.velocity.context.Context context, jakarta.servlet.http.HttpServletResponse response) Overrides VelocityViewServlet.mergeTemplate to do a two-pass render for handling layouts从类继承的方法 org.apache.velocity.tools.view.VelocityViewServlet
createContext, doGet, doPost, doRequest, findInitParameter, getLog, getOutputWriter, getTemplate, getTemplate, getVelocityProperty, getVelocityView, handleRequest, initRequest, manageResourceNotFound, mergeTemplate, requestCleanup, setContentType, setVelocityView从类继承的方法 jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service从类继承的方法 jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
字段详细资料
-
PROPERTY_ERROR_TEMPLATE
The velocity.properties key for specifying the servlet's error template.- 另请参阅:
-
PROPERTY_LAYOUT_DIR
The velocity.properties key for specifying the relative directory holding layout templates.- 另请参阅:
-
PROPERTY_DEFAULT_LAYOUT
The velocity.properties key for specifying the servlet's default layout template's filename.- 另请参阅:
-
DEFAULT_ERROR_TEMPLATE
The default error template's filename.- 另请参阅:
-
DEFAULT_LAYOUT_DIR
The default layout directory- 另请参阅:
-
DEFAULT_DEFAULT_LAYOUT
The default filename for the servlet's default layout- 另请参阅:
-
KEY_SCREEN_CONTENT
The context key that will hold the content of the screen. This key ($screen_content) must be present in the layout template for the current screen to be rendered.- 另请参阅:
-
KEY_LAYOUT
The context/parameter key used to specify an alternate layout to be used for a request instead of the default layout.- 另请参阅:
-
KEY_ERROR_CAUSE
The context key that holds theThrowablethat broke the rendering of the requested screen.- 另请参阅:
-
KEY_ERROR_STACKTRACE
The context key that holds the stack trace of the error that broke the rendering of the requested screen.- 另请参阅:
-
KEY_ERROR_INVOCATION_EXCEPTION
The context key that holds theMethodInvocationExceptionthat 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.- 另请参阅:
-
PROPERTY_DYNAMIC_LAYOUT
The velocity.properties key for specifying whether dynamic layout change is allowed- 另请参阅:
-
errorTemplate
-
layoutDir
-
defaultLayout
-
-
构造器详细资料
-
VelocityLayoutServlet
public VelocityLayoutServlet()
-
-
方法详细资料
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException Initializes Velocity, the view servlet and checks for changes to the initial layout configuration.- 指定者:
init在接口中jakarta.servlet.Servlet- 覆盖:
init在类中VelocityViewServlet- 参数:
config- servlet configuration parameters- 抛出:
jakarta.servlet.ServletException
-
fillContext
protected void fillContext(org.apache.velocity.context.Context ctx, jakarta.servlet.http.HttpServletRequest request) Overrides VelocityViewServlet to check the request for an alternate layout- 覆盖:
fillContext在类中VelocityViewServlet- 参数:
ctx- context for this requestrequest- client request
-
findLayout
Searches for a non-default layout to be used for this request. This implementation checks the request parameters and attributes.- 参数:
request- servlet request- 返回:
- layout name or null
-
mergeTemplate
protected void mergeTemplate(org.apache.velocity.Template template, org.apache.velocity.context.Context context, jakarta.servlet.http.HttpServletResponse response) throws IOException Overrides VelocityViewServlet.mergeTemplate to do a two-pass render for handling layouts- 覆盖:
mergeTemplate在类中VelocityViewServlet- 参数:
template-Templateobjectcontext- Velocity contextresponse- servlet response- 抛出:
IOException
-
error
protected void error(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Throwable e) Overrides VelocityViewServlet to display user's custom error template- 覆盖:
error在类中VelocityViewServlet- 参数:
request- servlet requestresponse- servlet responsee- thrown error
-