Package org.apache.velocity.tools.view
Interface ViewContext
-
- All Known Implementing Classes:
ViewToolContext
public interface ViewContextThis 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.- Version:
- $Id$
- Author:
- Gabe Sidler, Geir Magnusson Jr., Nathan Bubna
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAPPLICATIONKey used for the servlet context object in templates.static java.lang.StringDEFAULT_TOOLBOX_KEYDefault key used to store toolboxes in request/session/application attributes.static java.lang.StringREQUESTKey used for the HTTP request object.static java.lang.StringRESPONSEKey used for the HTTP response object.static java.lang.StringSERVLET_CONTEXT_KEYKey used for the servlet context object in tool properties.static java.lang.StringSESSIONKey used for the HTTP session object.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.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.javax.servlet.http.HttpServletRequestgetRequest()javax.servlet.http.HttpServletResponsegetResponse()javax.servlet.ServletContextgetServletContext()org.apache.velocity.context.ContextgetVelocityContext()org.apache.velocity.app.VelocityEnginegetVelocityEngine()
-
-
-
Field Detail
-
REQUEST
static final java.lang.String REQUEST
Key used for the HTTP request object.- See Also:
- Constant Field Values
-
RESPONSE
static final java.lang.String RESPONSE
Key used for the HTTP response object.- See Also:
- Constant Field Values
-
SESSION
static final java.lang.String SESSION
Key used for the HTTP session object.- See Also:
- Constant Field Values
-
APPLICATION
static final java.lang.String APPLICATION
Key used for the servlet context object in templates.- See Also:
- Constant Field Values
-
SERVLET_CONTEXT_KEY
static final java.lang.String SERVLET_CONTEXT_KEY
Key used for the servlet context object in tool properties.- See Also:
- Constant Field Values
-
DEFAULT_TOOLBOX_KEY
static final java.lang.String DEFAULT_TOOLBOX_KEY
Default key used to store toolboxes in request/session/application attributes.
-
-
Method Detail
-
getRequest
javax.servlet.http.HttpServletRequest getRequest()
- Returns:
- the instance of
HttpServletRequestfor this request.
-
getResponse
javax.servlet.http.HttpServletResponse getResponse()
- Returns:
- the instance of
HttpServletResponsefor this request.
-
getServletContext
javax.servlet.ServletContext getServletContext()
- Returns:
- the instance of
ServletContextfor this request.
-
getAttribute
java.lang.Object getAttribute(java.lang.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.
- Parameters:
key- attribute key- Returns:
- attribute value or null
- Since:
- VelocityTools 1.1
-
getVelocityContext
org.apache.velocity.context.Context getVelocityContext()
- Returns:
- a reference to the current Velocity context.
-
getVelocityEngine
org.apache.velocity.app.VelocityEngine getVelocityEngine()
- Returns:
- the current VelocityEngine instance.
-
-