接口 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 String
    Key used for the servlet context object in templates.
    static final String
    Default key used to store toolboxes in request/session/application attributes.
    static final String
    Key used for the HTTP request object.
    static final String
    Key used for the HTTP response object.
    static final String
    Key used for the servlet context object in tool properties.
    static final String
    Key used for the HTTP session object.
  • 方法概要

    修饰符和类型
    方法
    说明
    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.HttpServletRequest
     
    jakarta.servlet.http.HttpServletResponse
     
    jakarta.servlet.ServletContext
     
    org.apache.velocity.context.Context
     
    org.apache.velocity.app.VelocityEngine
     
  • 字段详细资料

    • REQUEST

      static final String REQUEST
      Key used for the HTTP request object.
      另请参阅:
    • RESPONSE

      static final String RESPONSE
      Key used for the HTTP response object.
      另请参阅:
    • SESSION

      static final String SESSION
      Key used for the HTTP session object.
      另请参阅:
    • APPLICATION

      static final String APPLICATION
      Key used for the servlet context object in templates.
      另请参阅:
    • SERVLET_CONTEXT_KEY

      static final String SERVLET_CONTEXT_KEY
      Key used for the servlet context object in tool properties.
      另请参阅:
    • DEFAULT_TOOLBOX_KEY

      static final String DEFAULT_TOOLBOX_KEY
      Default key used to store toolboxes in request/session/application attributes.
  • 方法详细资料

    • getRequest

      jakarta.servlet.http.HttpServletRequest getRequest()
      返回:
      the instance of HttpServletRequest for this request.
    • getResponse

      jakarta.servlet.http.HttpServletResponse getResponse()
      返回:
      the instance of HttpServletResponse for this request.
    • getServletContext

      jakarta.servlet.ServletContext getServletContext()
      返回:
      the instance of ServletContext for this request.
    • getAttribute

      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.

      参数:
      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.