| org.apache.velocity.VelocityContext org.apache.velocity.tools.view.context.ChainedContext
ChainedContext | public class ChainedContext extends VelocityContext implements ViewContext(Code) | | Velocity context implementation specific to the Servlet environment.
It provides the following special features:
- puts the request, response, session, and servlet context objects
into the Velocity context for direct access, and keeps them
read-only
- supports a read-only toolbox of view tools
- auto-searches servlet request attributes, session attributes and
servlet context attribues for objects
The
ChainedContext.internalGet(String key) method implements the following search order
for objects:
- toolbox
- servlet request, servlet response, servlet session, servlet context
- local hashtable of objects (traditional use)
- servlet request attribues, servlet session attribute, servlet context
attributes
The purpose of this class is to make it easy for web designer to work
with Java servlet based web applications. They do not need to be concerned
with the concepts of request, session or application attributes and the
lifetime of objects in these scopes.
Note that the put() method always puts objects into the local hashtable.
author: Geir Magnusson Jr. author: Gabe Sidler version: $Id: ChainedContext.java 480849 2006-11-30 06:19:04Z nbubna $ |
Constructor Summary | |
public | ChainedContext(Context ctx, HttpServletRequest request, HttpServletResponse response, ServletContext application) | public | ChainedContext(VelocityEngine velocity, HttpServletRequest request, HttpServletResponse response, ServletContext application) | public | ChainedContext(Context ctx, VelocityEngine velocity, HttpServletRequest request, HttpServletResponse response, ServletContext application) |
getAttribute | public Object getAttribute(String key)(Code) | | 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 |
getToolbox | public Map getToolbox()(Code) | | Returns a read-only view of the toolbox
Map for this context.
since: VelocityTools 1.3 an unmodifiable version of the toolbox for this requestor null if there is none |
getVelocityContext | public Context getVelocityContext()(Code) | | Returns a reference to the Velocity context (this object).
|
getVelocityEngine | public VelocityEngine getVelocityEngine()(Code) | | Returns a reference to the VelocityEngine.
|
internalGet | public Object internalGet(String key)(Code) | | Looks up and returns the object with the specified key.
See the class documentation for more details.
Parameters: key - the key of the object requested the requested object or null if not found |
setToolbox | public void setToolbox(Map box)(Code) | | Sets the toolbox of view tools.
Parameters: box - toolbox of view tools |
|
|