|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.context.InternalContextBase org.apache.velocity.context.AbstractContext org.apache.velocity.VelocityContext org.apache.velocity.tools.view.context.ChainedContext
Velocity context implementation specific to the Servlet environment.
It provides the following special features:
The internalGet(String key)
method implements the following search order
for objects:
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.
Field Summary | |
private javax.servlet.ServletContext |
application
A local reference to the servlet context. |
private javax.servlet.http.HttpServletRequest |
request
A local reference to the current servlet request. |
private javax.servlet.http.HttpServletResponse |
response
A local reference to the current servlet response. |
private javax.servlet.http.HttpSession |
session
A local reference to the servlet session. |
private ToolboxContext |
toolboxContext
The toolbox. |
Fields inherited from class org.apache.velocity.VelocityContext |
|
Fields inherited from class org.apache.velocity.context.AbstractContext |
|
Fields inherited from interface org.apache.velocity.tools.view.context.ViewContext |
APPLICATION, REQUEST, RESPONSE, SESSION, XHTML |
Constructor Summary | |
ChainedContext(org.apache.velocity.context.Context ctx,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext application)
Default constructor. |
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 current servlet request. |
javax.servlet.http.HttpServletResponse |
getResponse()
Returns the current servlet response. |
javax.servlet.ServletContext |
getServletContext()
Returns the servlet context. |
org.apache.velocity.context.Context |
getVelocityContext()
Returns a reference to the Velocity context (this object). |
java.lang.Object |
internalGet(java.lang.String key)
Looks up and returns the object with the specified key. |
void |
setToolbox(ToolboxContext box)
Sets the toolbox of view tools. |
Methods inherited from class org.apache.velocity.VelocityContext |
clone, internalContainsKey, internalGetKeys, internalPut, internalRemove |
Methods inherited from class org.apache.velocity.context.AbstractContext |
attachEventCartridge, containsKey, get, getChainedContext, getCurrentResource, getCurrentTemplateName, getEventCartridge, getKeys, getTemplateNameStack, icacheGet, icachePut, popCurrentTemplateName, pushCurrentTemplateName, put, remove, setCurrentResource |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private javax.servlet.http.HttpServletRequest request
private javax.servlet.http.HttpServletResponse response
private javax.servlet.http.HttpSession session
private javax.servlet.ServletContext application
private ToolboxContext toolboxContext
Constructor Detail |
public ChainedContext(org.apache.velocity.context.Context ctx, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext application)
Method Detail |
public void setToolbox(ToolboxContext box)
Sets the toolbox of view tools.
box
- toolbox of view toolspublic java.lang.Object internalGet(java.lang.String key)
Looks up and returns the object with the specified key.
See the class documentation for more details.
key
- the key of the object requested
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.
getAttribute
in interface ViewContext
public javax.servlet.http.HttpServletRequest getRequest()
Returns the current servlet request.
getRequest
in interface ViewContext
public javax.servlet.http.HttpServletResponse getResponse()
Returns the current servlet response.
getResponse
in interface ViewContext
public javax.servlet.ServletContext getServletContext()
Returns the servlet context.
getServletContext
in interface ViewContext
public org.apache.velocity.context.Context getVelocityContext()
Returns a reference to the Velocity context (this object).
getVelocityContext
in interface ViewContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |