Package: io.vertx.groovy.core.http

## [Groovy] Class HttpServerRequest

- io.vertx.groovy.core.http.HttpServerRequest

- All Implemented Interfaces and Traits:
    ReadStream

      @groovy.transform.CompileStatic
      class HttpServerRequest
      extends java.lang.Object

  Represents a server-side HTTP request.

  Instances are created for each request and passed to the user via a handler.

  Each instance of this class is associated with a corresponding HttpServerResponse instance via HttpServerRequest.response.

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

- - ### Constructor Summary

    Constructors
    Constructor and description
    `HttpServerRequest (java.lang.Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `java.lang.String` | `absoluteURI()` @return the absolute URI corresponding to the the HTTP request
    `HttpServerRequest` | `bodyHandler(io.vertx.core.Handler<Buffer> bodyHandler)` Convenience method for receiving the entire request body in one piece.
    `HttpConnection` | `connection()` @return the HttpConnection associated with this request
    `HttpServerRequest` | `customFrameHandler(io.vertx.core.Handler<HttpFrame> handler)` Set a custom frame handler.
    `HttpServerRequest` | `endHandler(io.vertx.core.Handler<java.lang.Void> endHandler)`
    `HttpServerRequest` | `exceptionHandler(io.vertx.core.Handler<java.lang.Throwable> handler)`
    `MultiMap` | `formAttributes()` Returns a map of all form attributes in the request.
    `java.lang.Object` | `getDelegate()`
    `java.lang.String` | `getFormAttribute(java.lang.String attributeName)` Return the first form attribute value with the specified name
    `java.lang.String` | `getHeader(java.lang.String headerName)` Return the first header value with the specified name
    `java.lang.String` | `getParam(java.lang.String paramName)` Return the first param value with the specified name
    `HttpServerRequest` | `handler(io.vertx.core.Handler<Buffer> handler)`
    `MultiMap` | `headers()` @return the headers in the request.
    `java.lang.String` | `host()` Returns: the request host.
    `boolean` | `isEnded()` Has the request ended?
    `boolean` | `isExpectMultipart()` Returns: true if we are expecting a multi-part body for this request.
    `boolean` | `isSSL()` @return true if this NetSocket is encrypted via SSL/TLS
    `SocketAddress` | `localAddress()` @return the local (server side) address of the server that handles the request
    `io.vertx.core.http.HttpMethod` | `method()` @return the HTTP method for the request.
    `NetSocket` | `netSocket()` Get a net socket for the underlying connection of this request.
    `MultiMap` | `params()` @return the query parameters in the request
    `java.lang.String` | `path()` Returns: The path part of the uri.
    `HttpServerRequest` | `pause()`
    `java.lang.String` | `query()` Returns: the query part of the uri.
    `java.lang.String` | `rawMethod()` @return the HTTP method as sent by the client
    `SocketAddress` | `remoteAddress()` @return the remote (client side) address of the request
    `HttpServerResponse` | `response()` Returns: the response.
    `HttpServerRequest` | `resume()`
    `java.lang.String` | `scheme()` @return the scheme of the request
    `HttpServerRequest` | `setExpectMultipart(boolean expect)` Call this with true if you are expecting a multi-part body to be submitted in the request.
    `ServerWebSocket` | `upgrade()` Upgrade the connection to a WebSocket connection.
    `HttpServerRequest` | `uploadHandler(io.vertx.core.Handler<HttpServerFileUpload> uploadHandler)` Set an upload handler.
    `java.lang.String` | `uri()` Returns: the URI of the request.
    `io.vertx.core.http.HttpVersion` | `version()` @return the HTTP version of the request

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `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(java.lang.Object delegate)

  - ### Method Detail

    - #### java.lang.String absoluteURI()

      Returns:
        the absolute URI corresponding to the the HTTP request

    - #### HttpServerRequest bodyHandler(io.vertx.core.Handler<Buffer> bodyHandler)

      Convenience method for receiving the entire request body in one piece.

      This saves the user having to manually setting 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.

      Returns:
      Parameters:
        `bodyHandler` - This handler will be called after all the body has been received

    - #### HttpConnection connection()

      Returns:
        the HttpConnection associated with this request

    - #### HttpServerRequest customFrameHandler(io.vertx.core.Handler<HttpFrame> handler)

      Set a custom frame handler. The handler will get notified when the http stream receives an custom HTTP/2 frame. HTTP/2 permits extension of the protocol.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        handler

    - #### HttpServerRequest endHandler(io.vertx.core.Handler<java.lang.Void> endHandler)

    - #### HttpServerRequest exceptionHandler(io.vertx.core.Handler<java.lang.Throwable> handler)

    - #### MultiMap formAttributes()

      Returns a map of all form attributes in the request.

      Be aware that the attributes will only be available after the whole body has been received, i.e. after the request end handler has been called.

      HttpServerRequest.setExpectMultipart must be called first before trying to get the form attributes.

      Returns:
        the form attributes

    - #### java.lang.Object getDelegate()

    - #### java.lang.String getFormAttribute(java.lang.String attributeName)

      Return the first form attribute value with the specified name

      Returns:
        the attribute value
      Parameters:
        `attributeName` - the attribute name

    - #### java.lang.String getHeader(java.lang.String headerName)

      Return the first header value with the specified name

      Returns:
        the header value
      Parameters:
        `headerName` - the header name

    - #### java.lang.String getParam(java.lang.String paramName)

      Return the first param value with the specified name

      Returns:
        the param value
      Parameters:
        `paramName` - the param name

    - #### HttpServerRequest handler(io.vertx.core.Handler<Buffer> handler)

    - #### MultiMap headers()

      Returns:
        the headers in the request.

    - #### java.lang.String host()

      Returns:
        the request host. For HTTP2 it returns the pseudo header otherwise it returns the header

    - #### boolean isEnded()

      Has the request ended? I.e. has the entire request, including the body been read?

      Returns:
        true if ended

    - #### boolean isExpectMultipart()

      Returns:
        true if we are expecting a multi-part body for this request. See HttpServerRequest.setExpectMultipart.

    - #### boolean isSSL()

      Returns:
        true if this NetSocket is encrypted via SSL/TLS

    - #### SocketAddress localAddress()

      Returns:
        the local (server side) address of the server that handles the request

    - #### io.vertx.core.http.HttpMethod method()

      Returns:
        the HTTP method for the request.

    - #### NetSocket netSocket()

      Get a net socket for the underlying connection of this request.

      USE THIS WITH CAUTION!

      Once you have called this method, you must handle writing to the connection yourself using the net socket, the server request instance will no longer be usable as normal. Writing to the socket directly if you don't know what you're doing can easily break the HTTP protocol.

      Returns:
        the net socket

    - #### MultiMap params()

      Returns:
        the query parameters in the request

    - #### java.lang.String path()

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

    - #### HttpServerRequest pause()

    - #### java.lang.String query()

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

    - #### java.lang.String rawMethod()

      Returns:
        the HTTP method as sent by the client

    - #### SocketAddress remoteAddress()

      Returns:
        the remote (client side) address of the request

    - #### HttpServerResponse response()

      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.

    - #### HttpServerRequest resume()

    - #### java.lang.String scheme()

      Returns:
        the scheme of the request

    - #### HttpServerRequest setExpectMultipart(boolean expect)

      Call this with true if you are expecting a multi-part body to be submitted in the request. This must be called before the body of the request has been received

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `expect` - true - if you are expecting a multi-part body

    - #### ServerWebSocket upgrade()

      Upgrade the connection to a WebSocket connection.

      This is an alternative way of handling WebSockets and can only be used if no websocket handlers are set on the Http server, and can only be used during the upgrade request during the WebSocket handshake.

      Returns:
        the WebSocket

    - #### HttpServerRequest uploadHandler(io.vertx.core.Handler<HttpServerFileUpload> uploadHandler)

      Set an upload handler. The handler will get notified once a new file upload was received to allow you to deal with the file upload.

      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        uploadHandler

    - #### java.lang.String uri()

      Returns:
        the URI of the request. This is usually a relative URI

    - #### io.vertx.core.http.HttpVersion version()

      Returns:
        the HTTP version of the request