|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.tools.view.tools.ContextTool
public class ContextTool
View tool for convenient access to ViewContext
data and
meta-data.
Template example(s): #foreach( $key in $context.keys ) $key = $context.get($key) #end Toolbox configuration: <tool> <key>context</key> <scope>request</scope> <class>org.apache.velocity.tools.view.tools.ContextTool</class> </tool>
This class is only designed for use as a request-scope VelocityView tool.
Field Summary | |
---|---|
protected javax.servlet.ServletContext |
application
|
protected ViewContext |
context
|
protected javax.servlet.http.HttpServletRequest |
request
|
static java.lang.String |
SAFE_MODE_KEY
The key used for specifying whether to hide keys with '.' in them. |
private boolean |
safeMode
|
protected javax.servlet.http.HttpSession |
session
|
protected java.util.Map |
toolbox
|
Constructor Summary | |
---|---|
ContextTool()
|
Method Summary | |
---|---|
void |
configure(java.util.Map params)
Looks for a safe-mode configuration setting. |
boolean |
contains(java.lang.Object refName)
Returns true if the context contains a value for the specified
reference name (aka context key). |
java.lang.Object |
get(java.lang.Object refName)
Retrieves the value for the specified reference name (aka context key). |
java.util.Set |
getKeys()
Return a Set of the available reference keys in the current
context. |
ViewContext |
getThis()
Returns the context being analyzed by this tool. |
java.util.Map |
getToolbox()
Returns a read-only view of the toolbox Map
for this context. |
java.util.Set |
getValues()
Return a Set of the available values in the current
context. |
void |
init(java.lang.Object obj)
Initializes this instance for the current request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SAFE_MODE_KEY
protected ViewContext context
protected java.util.Map toolbox
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpSession session
protected javax.servlet.ServletContext application
private boolean safeMode
Constructor Detail |
---|
public ContextTool()
Method Detail |
---|
public void configure(java.util.Map params)
public void init(java.lang.Object obj)
obj
- the ViewContext of the current requestpublic ViewContext getThis()
public java.util.Map getToolbox()
Returns a read-only view of the toolbox Map
for this context.
null
if there is nonepublic java.util.Set getKeys()
Return a Set
of the available reference keys in the current
context.
public java.util.Set getValues()
Return a Set
of the available values in the current
context.
public boolean contains(java.lang.Object refName)
Returns true
if the context contains a value for the specified
reference name (aka context key).
public java.lang.Object get(java.lang.Object refName)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |