## groovy.servlet
Class ServletBinding

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

author:
  Christian Stein

Field Summary
`Binding` | `binding`
`ServletContext` | `context`
`MarkupBuilder` | `html`
`HttpServletRequest` | `request`
`HttpServletResponse` | `response`

Constructor Summary
`ServletBinding(HttpServletRequest request, HttpServletResponse response, ServletContext context)` Initializes a servlet binding.

Method Summary
`Object` | `getVariable(String name)`
`Map` | `getVariables()`
`void` | `setVariable(String name, Object value)`

Constructor Detail

### ServletBinding

    public ServletBinding(HttpServletRequest request, HttpServletResponse response, ServletContext context)

  Initializes a servlet binding.

Method Detail

### getVariable

    public Object getVariable(String name)

  return:
    a writer, an output stream, a markup builder or another requested object

### getVariables

    public Map getVariables()

### setVariable

    public void setVariable(String name, Object value)