Java Reference
In-Depth Information
Listing 10.7. Using
GroovyShellTestCase
to simplify unit-testing groovlets
The
GroovyShellTestCase
class instantiates a
GroovyShell
internally and allows
you to pass a map of binding parameters through the
withBinding
method.
10.2.2. Implicit variables in groovlets
The previous example shows that groovlets expect that all the request parameters are
bundled into a map called
params
. Groovlets operate in an environment containing many
implicit variables.
Table 10.2
shows the complete list.
Table 10.2. Implicit variables available in groovlets
Variable
Represents
Notes
request
ServletRequest
response
ServletResponse
session
getSession(false)
May be null
context
ServletContext
application
ServletContext (same as context)
params
Map of request parameters
headers
Map of request/response headers