public class ViewContextTool extends ContextTool
Extension of ContextTool
that includes keys and values
from the HttpServletRequest
, HttpSession
and
ServletContext
.
Template example(s):
#foreach( $key in $context.keys ) $key = $context.get($key) #end
Toolbox configuration:
<tools> <toolbox scope="request"> <tool class="org.apache.velocity.tools.view.ViewContextTool"/> </toolbox> </tools>
This class is only designed for use as a request-scope VelocityView tool.
Modifier and Type | Field and Description |
---|---|
protected javax.servlet.ServletContext |
application |
protected javax.servlet.http.HttpServletRequest |
request |
protected javax.servlet.http.HttpSession |
session |
context, toolbox
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
Constructor and Description |
---|
ViewContextTool() |
Modifier and Type | Method and Description |
---|---|
protected void |
configure(ValueParser parser)
Initializes this instance for the current request.
|
protected void |
fillKeyset(Set keys)
Actually do the work of filling in the set of keys
for
ContextTool.getKeys() here so subclasses can add keys too. |
contains, get, getKeys, getThis, getToolbox, getValues
configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpSession session
protected javax.servlet.ServletContext application
protected void configure(ValueParser parser)
ContextTool
configure
in class ContextTool
parser
- configuration valuesprotected void fillKeyset(Set keys)
ContextTool
ContextTool.getKeys()
here so subclasses can add keys too.fillKeyset
in class ContextTool
keys
- set to fill with keysCopyright © 2002–2021 The Apache Software Foundation. All rights reserved.