org.apache.velocity.tools.view.context
Interface ViewContext

All Known Implementing Classes:
ChainedContext

public interface ViewContext

Objects implementing this interface are passed to view tools upon initialization by the ServletToolboxManager.

The interface provides view tools in a servlet environment access to relevant context information, like servlet request, servlet context and the velocity context.

Version:
$Id: ViewContext.java 72106 2004-11-11 04:07:24Z nbubna $
Author:
Gabe Sidler, Geir Magnusson Jr.

Field Summary
static java.lang.String APPLICATION
          Key used for the servlet context object.
static java.lang.String REQUEST
          Key used for the HTTP request object.
static java.lang.String RESPONSE
          Key used for the HTTP response object.
static java.lang.String SESSION
          Key used for the HTTP session object.
static java.lang.String XHTML
          Key used for XHTML setting (tells tools and macros to output XHTML).
 
Method Summary
 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.
 javax.servlet.http.HttpServletRequest getRequest()
          Returns the instance of HttpServletRequest for this request.
 javax.servlet.http.HttpServletResponse getResponse()
          Returns the instance of HttpServletResponse for this request.
 javax.servlet.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

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

See Also:
Constant Field Values

RESPONSE

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

See Also:
Constant Field Values

SESSION

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

See Also:
Constant Field Values

APPLICATION

public static final java.lang.String APPLICATION
Key used for the servlet context object.

See Also:
Constant Field Values

XHTML

public static final java.lang.String XHTML
Key used for XHTML setting (tells tools and macros to output XHTML).

See Also:
Constant Field Values
Method Detail

getRequest

public javax.servlet.http.HttpServletRequest getRequest()

Returns the instance of HttpServletRequest for this request.


getResponse

public javax.servlet.http.HttpServletResponse getResponse()

Returns the instance of HttpServletResponse for this request.


getServletContext

public javax.servlet.ServletContext getServletContext()

Returns the instance of ServletContext for this request.


getAttribute

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

Since:
VelocityTools 1.1

getVelocityContext

public org.apache.velocity.context.Context getVelocityContext()

Returns a reference to the current Velocity context.


getVelocityEngine

public org.apache.velocity.app.VelocityEngine getVelocityEngine()

Returns the current VelocityEngine instance.



Copyright (c) 2003 Apache Software Foundation