接口 ViewContext
- 所有已知实现类:
ViewToolContext
public interface ViewContext
This interface provides view tools in a servlet environment access to relevant context information, like servlet request, servlet context and the velocity context.
The standard implementation is ViewToolContext.
- 版本:
- $Id$
- 作者:
- Gabe Sidler, Geir Magnusson Jr., Nathan Bubna
-
字段概要
字段修饰符和类型字段说明static final StringKey used for the servlet context object in templates.static final StringDefault key used to store toolboxes in request/session/application attributes.static final StringKey used for the HTTP request object.static final StringKey used for the HTTP response object.static final StringKey used for the servlet context object in tool properties.static final StringKey used for the HTTP session object. -
方法概要
修饰符和类型方法说明getAttribute(String key) Searches for the named attribute in request, session (if valid), and application scope(s) in order and returns the value associated or null.jakarta.servlet.http.HttpServletRequestjakarta.servlet.http.HttpServletResponsejakarta.servlet.ServletContextorg.apache.velocity.context.Contextorg.apache.velocity.app.VelocityEngine
-
字段详细资料
-
REQUEST
Key used for the HTTP request object.- 另请参阅:
-
RESPONSE
Key used for the HTTP response object.- 另请参阅:
-
SESSION
Key used for the HTTP session object.- 另请参阅:
-
APPLICATION
Key used for the servlet context object in templates.- 另请参阅:
-
SERVLET_CONTEXT_KEY
Key used for the servlet context object in tool properties.- 另请参阅:
-
DEFAULT_TOOLBOX_KEY
Default key used to store toolboxes in request/session/application attributes.
-
-
方法详细资料
-
getRequest
jakarta.servlet.http.HttpServletRequest getRequest()- 返回:
- the instance of
HttpServletRequestfor this request.
-
getResponse
jakarta.servlet.http.HttpServletResponse getResponse()- 返回:
- the instance of
HttpServletResponsefor this request.
-
getServletContext
jakarta.servlet.ServletContext getServletContext()- 返回:
- the instance of
ServletContextfor this request.
-
getAttribute
Searches for the named attribute in request, session (if valid), and application scope(s) in order and returns the value associated or null.
- 参数:
key- attribute key- 返回:
- attribute value or null
- 从以下版本开始:
- VelocityTools 1.1
-
getVelocityContext
org.apache.velocity.context.Context getVelocityContext()- 返回:
- a reference to the current Velocity context.
-
getVelocityEngine
org.apache.velocity.app.VelocityEngine getVelocityEngine()- 返回:
- the current VelocityEngine instance.
-