Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.vertx.groovy.core.http
[Groovy] Class HttpServerRequest

    java.lang.Object
      org.vertx.groovy.core.http.HttpServerRequest

All Implemented Interfaces:
  ReadStream

    class HttpServerRequest

Represents a server-side HTTP request.

An instance of this class is created for each request that is handled by the server and is passed to the user via the handler instance registered with the HttpServer using the method HttpServer#requestHandler(Closure)#requestHandler(Closure).

Each instance of this class is associated with a corresponding HttpServerResponse instance via the `response` field.

It implements ReadStream so it can be used with Pump to pump data with flow control.

Instances of this class are not thread-safe

Authors:
  Peter Ledbrook
  Tim Fox

Constructor Summary
`protected HttpServerRequest(JHttpServerRequest jRequest)`

Method Summary
`void` | `bodyHandler(groovy.lang.Closure bodyHandler)` Convenience method for receiving the entire request body in one piece.
`void` | `dataHandler(groovy.lang.Closure dataHandler)` {@inheritDoc}
`void` | `endHandler(groovy.lang.Closure handler)` {@inheritDoc}
`void` | `exceptionHandler(groovy.lang.Closure handler)` {@inheritDoc}
`java.util.Map` | `getHeaders()` A map of all headers in the request, If the request contains multiple headers with the same key, the values will be concatenated together into a single header with the same key value, with each value separated by a comma, as specified here.
`java.lang.String` | `getMethod()` Returns: The HTTP method for the request.
`java.util.Map` | `getParams()` @return A map of all query parameters in the request
`java.lang.String` | `getPath()` Returns: The path part of the uri.
`java.lang.String` | `getQuery()` Returns: The query part of the uri.
`HttpServerResponse` | `getResponse()` Returns: The response.
`java.lang.String` | `getUri()` Returns: The uri of the request.
`void` | `pause()` {@inheritDoc}
`void` | `resume()` {@inheritDoc}
`HttpServerRequest` | `toJavaRequest()`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### HttpServerRequest

    protected HttpServerRequest(JHttpServerRequest jRequest)

Method Detail

### bodyHandler

    void bodyHandler(groovy.lang.Closure bodyHandler)

  Convenience method for receiving the entire request body in one piece. This saves the user having to manually set a data and end handler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.
  Parameters:
    `bodyHandler` - This handler will be called after all the body has been received

### dataHandler

    void dataHandler(groovy.lang.Closure dataHandler)

  {@inheritDoc}

### endHandler

    void endHandler(groovy.lang.Closure handler)

  {@inheritDoc}

### exceptionHandler

    void exceptionHandler(groovy.lang.Closure handler)

  {@inheritDoc}

### getHeaders

    java.util.Map getHeaders()

  A map of all headers in the request, If the request contains multiple headers with the same key, the values will be concatenated together into a single header with the same key value, with each value separated by a comma, as specified here. The headers will be automatically lower-cased when they reach the server

### getMethod

    java.lang.String getMethod()

  Returns:
    The HTTP method for the request. One of GET, PUT, POST, DELETE, TRACE, CONNECT, OPTIONS, HEAD

### getParams

    java.util.Map getParams()

  Returns:
    A map of all query parameters in the request

### getPath

    java.lang.String getPath()

  Returns:
    The path part of the uri. For example /somepath/somemorepath/somresource.foo

### getQuery

    java.lang.String getQuery()

  Returns:
    The query part of the uri. For example someparam=32&someotherparam=x

### getResponse

    HttpServerResponse getResponse()

  Returns:
    The response. Each instance of this class has an HttpServerResponse instance attached to it. This is used to send the response back to the client.

### getUri

    java.lang.String getUri()

  Returns:
    The uri of the request. For example http://www.somedomain.com/somepath/somemorepath/somresource.foo?someparam=32&someotherparam=x

### pause

    void pause()

  {@inheritDoc}

### resume

    void resume()

  {@inheritDoc}

### toJavaRequest

    HttpServerRequest toJavaRequest()

Groovy Documentation