groovy.servlet
Class ServletBinding
java.lang.Object
groovy.lang.GroovyObjectSupport
groovy.lang.Binding
groovy.servlet.ServletBinding
- All Implemented Interfaces:
- GroovyObject
public class ServletBinding
- extends Binding
Servlet-specific binding extension to lazy load the writer or the output
stream from the response.
Default variables bound
- "request" : the HttpServletRequest object
- "response" : the HttpServletResponse object
- "context" : the ServletContext object
- "application" : same as context
- "session" : convenient for
request.getSession(false)
- can be null!
- "params" : map of all form parameters - can be empty
- "headers" : map of all request header fields
Implicite bound variables
- "out" : response.getWriter()
- "sout" : response.getOutputStream()
- "html" : new MarkupBuilder(response.getWriter())
- Author:
- Guillaume Laforge, Christian Stein
Constructor Summary |
ServletBinding(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext context)
Initializes a servlet binding. |
Method Summary |
java.lang.Object |
getVariable(java.lang.String name)
|
java.util.Map |
getVariables()
|
void |
setVariable(java.lang.String name,
java.lang.Object value)
Sets the value of the given variable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
binding
private final Binding binding
context
private final javax.servlet.ServletContext context
request
private final javax.servlet.http.HttpServletRequest request
response
private final javax.servlet.http.HttpServletResponse response
html
private MarkupBuilder html
ServletBinding
public ServletBinding(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext context)
- Initializes a servlet binding.
setVariable
public void setVariable(java.lang.String name,
java.lang.Object value)
- Description copied from class:
Binding
- Sets the value of the given variable
- Overrides:
setVariable
in class Binding
- Parameters:
name
- the name of the variable to setvalue
- the new value for the given variable
getVariables
public java.util.Map getVariables()
- Overrides:
getVariables
in class Binding
getVariable
public java.lang.Object getVariable(java.lang.String name)
- Overrides:
getVariable
in class Binding
- Parameters:
name
- the name of the variable to lookup
- Returns:
- a writer, an output stream, a markup builder or another requested object
Copyright © ${year} The Codehaus. All Rights Reserved.