org.apache.velocity.tools.view
Interface ViewContext

All Known Subinterfaces:
ViewContext
All Known Implementing Classes:
ChainedContext, JspToolContext, 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.

Version:
$Id: ViewContext.java 961796 2010-07-08 15:18:15Z apetrelli $
Author:
Gabe Sidler, Geir Magnusson Jr., Nathan Bubna

Field Summary
static String APPLICATION
          Key used for the servlet context object in templates.
static String DEFAULT_TOOLBOX_KEY
          Default key used to store toolboxes in request/session/application attributes.
static String REQUEST
          Key used for the HTTP request object.
static String RESPONSE
          Key used for the HTTP response object.
static String SERVLET_CONTEXT_KEY
          Key used for the servlet context object in tool properties.
static String SESSION
          Key used for the HTTP session object.
 
Method Summary
 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.
 HttpServletRequest getRequest()
          Returns the instance of HttpServletRequest for this request.
 HttpServletResponse getResponse()
          Returns the instance of HttpServletResponse for this request.
 ServletContext getServletContext()
          Returns the instance of ServletContext for this request.
 org.apache.velocity.context.Context getVelocityContext()
          Returns a reference to the current Velocity context.
 org.apache.velocity.app.VelocityEngine getVelocityEngine()
          Returns the current VelocityEngine instance.
 

Field Detail

REQUEST

static final String REQUEST
Key used for the HTTP request object.

See Also:
Constant Field Values

RESPONSE

static final String RESPONSE
Key used for the HTTP response object.

See Also:
Constant Field Values

SESSION

static final String SESSION
Key used for the HTTP session object.

See Also:
Constant Field Values

APPLICATION

static final String APPLICATION
Key used for the servlet context object in templates.

See Also:
Constant Field Values

SERVLET_CONTEXT_KEY

static final String SERVLET_CONTEXT_KEY
Key used for the servlet context object in tool properties.

See Also:
Constant Field Values

DEFAULT_TOOLBOX_KEY

static final String DEFAULT_TOOLBOX_KEY
Default key used to store toolboxes in request/session/application attributes.

Method Detail

getRequest

HttpServletRequest getRequest()

Returns the instance of HttpServletRequest for this request.


getResponse

HttpServletResponse getResponse()

Returns the instance of HttpServletResponse for this request.


getServletContext

ServletContext getServletContext()

Returns 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.

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.



Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.