|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.velocity.context.AbstractContext org.apache.velocity.VelocityContext org.apache.velocity.tools.view.context.ChainedContext
public class 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
|
private javax.servlet.http.HttpServletRequest |
request
|
private javax.servlet.http.HttpServletResponse |
response
|
private javax.servlet.http.HttpSession |
session
|
private java.util.Map |
toolbox
|
private org.apache.velocity.app.VelocityEngine |
velocity
|
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)
Deprecated. This will be removed after VelocityTools 1.3 |
|
ChainedContext(org.apache.velocity.context.Context ctx,
org.apache.velocity.app.VelocityEngine velocity,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext application)
|
|
ChainedContext(org.apache.velocity.app.VelocityEngine velocity,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext application)
|
Method Summary | |
---|---|
org.apache.velocity.app.event.EventCartridge |
attachEventCartridge(org.apache.velocity.app.event.EventCartridge arg0)
|
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. |
org.apache.velocity.runtime.resource.Resource |
getCurrentResource()
|
java.lang.String |
getCurrentTemplateName()
|
org.apache.velocity.app.event.EventCartridge |
getEventCartridge()
|
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. |
java.lang.Object[] |
getTemplateNameStack()
|
java.util.Map |
getToolbox()
Returns a read-only view of the toolbox Map
for this context. |
org.apache.velocity.context.Context |
getVelocityContext()
Returns a reference to the Velocity context (this object). |
org.apache.velocity.app.VelocityEngine |
getVelocityEngine()
Returns a reference to the VelocityEngine. |
org.apache.velocity.util.introspection.IntrospectionCacheData |
icacheGet(java.lang.Object arg0)
|
void |
icachePut(java.lang.Object arg0,
org.apache.velocity.util.introspection.IntrospectionCacheData arg1)
|
java.lang.Object |
internalGet(java.lang.String key)
Looks up and returns the object with the specified key. |
void |
popCurrentTemplateName()
|
void |
pushCurrentTemplateName(java.lang.String arg0)
|
void |
setCurrentResource(org.apache.velocity.runtime.resource.Resource arg0)
|
void |
setToolbox(java.util.Map 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 |
---|
containsKey, get, getChainedContext, getKeys, put, remove |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Map toolbox
private javax.servlet.http.HttpServletRequest request
private javax.servlet.http.HttpServletResponse response
private javax.servlet.http.HttpSession session
private javax.servlet.ServletContext application
private org.apache.velocity.app.VelocityEngine velocity
Constructor Detail |
---|
public ChainedContext(org.apache.velocity.context.Context ctx, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext application)
public ChainedContext(org.apache.velocity.app.VelocityEngine velocity, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext application)
public ChainedContext(org.apache.velocity.context.Context ctx, org.apache.velocity.app.VelocityEngine velocity, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext application)
Method Detail |
---|
public void setToolbox(java.util.Map box)
Sets the toolbox of view tools.
box
- toolbox of view toolspublic java.util.Map getToolbox()
Returns a read-only view of the toolbox Map
for this context.
null
if there is nonepublic 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.
internalGet
in class org.apache.velocity.VelocityContext
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
public org.apache.velocity.app.VelocityEngine getVelocityEngine()
Returns a reference to the VelocityEngine.
getVelocityEngine
in interface ViewContext
public void pushCurrentTemplateName(java.lang.String arg0)
public void popCurrentTemplateName()
public java.lang.String getCurrentTemplateName()
public java.lang.Object[] getTemplateNameStack()
public org.apache.velocity.util.introspection.IntrospectionCacheData icacheGet(java.lang.Object arg0)
public void icachePut(java.lang.Object arg0, org.apache.velocity.util.introspection.IntrospectionCacheData arg1)
public void setCurrentResource(org.apache.velocity.runtime.resource.Resource arg0)
public org.apache.velocity.runtime.resource.Resource getCurrentResource()
public org.apache.velocity.app.event.EventCartridge attachEventCartridge(org.apache.velocity.app.event.EventCartridge arg0)
attachEventCartridge
in interface org.apache.velocity.context.InternalEventContext
public org.apache.velocity.app.event.EventCartridge getEventCartridge()
getEventCartridge
in interface org.apache.velocity.context.InternalEventContext
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |