Package: io.vertx.groovy.core.http

## [Groovy] Class HttpConnection

- io.vertx.groovy.core.http.HttpConnection

- Represents an HTTP connection.

  HTTP/1.x connection provides an limited implementation, the following methods are implemented:
  - HttpConnection.close
  - HttpConnection.closeHandler
  - HttpConnection.exceptionHandler

- - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `close()` Close the connection and all the currently active streams.
    `HttpConnection` | `closeHandler(io.vertx.core.Handler<java.lang.Void> handler)` Set a close handler.
    `HttpConnection` | `exceptionHandler(io.vertx.core.Handler<java.lang.Throwable> handler)` Set an handler called when a connection error happens
    `java.lang.Object` | `getDelegate()`
    `int` | `getWindowSize()` @return the current connection window size or `-1` for HTTP/1.x
    `HttpConnection` | `goAway(long errorCode)` Like HttpConnection.goAway with a last stream id `2^31-1`.
    `HttpConnection` | `goAway(long errorCode, int lastStreamId)` Like HttpConnection.goAway with no buffer.
    `HttpConnection` | `goAway(long errorCode, int lastStreamId, Buffer debugData)` Send a go away frame to the remote endpoint of the connection.
    `HttpConnection` | `goAwayHandler(io.vertx.core.Handler<java.util.Map<java.lang.String, java.lang.Object>> handler)` Set an handler called when a frame is received.
    `HttpConnection` | `ping(Buffer data, io.vertx.core.Handler<io.vertx.core.AsyncResult<Buffer>> pongHandler)` Send a frame to the remote endpoint.
    `HttpConnection` | `pingHandler(io.vertx.core.Handler<Buffer> handler)` Set an handler notified when a frame is received from the remote endpoint.
    `java.util.Map<java.lang.String, java.lang.Object>` | `remoteSettings()` @return the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x (see | `HttpConnection` | `remoteSettingsHandler(io.vertx.core.Handler<java.util.Map<java.lang.String, java.lang.Object>> handler)` Set an handler that is called when remote endpoint | `HttpConnection` | `setWindowSize(int windowSize)` Update the current connection wide window size to a new size.
    `java.util.Map<java.lang.String, java.lang.Object>` | `settings()` @return the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x (see | `HttpConnection` | `shutdown()` Initiate a connection shutdown, a go away frame is sent and the connection is closed when all current active streams are closed or after a time out of 30 seconds.
    `HttpConnection` | `shutdown(long timeoutMs)` Initiate a connection shutdown, a go away frame is sent and the connection is closed when all current streams will be closed or the `timeout` is fired.
    `HttpConnection` | `shutdownHandler(io.vertx.core.Handler<java.lang.Void> handler)` Set an handler called when a frame has been sent or received and all connections are closed.
    `HttpConnection` | `updateSettings(java.util.Map<java.lang.String, java.lang.Object> settings = [:])` Send to the remote endpoint an update of the server settings.
    `HttpConnection` | `updateSettings(java.util.Map<java.lang.String, java.lang.Object> settings = [:], io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler)` Send to the remote endpoint an update of this endpoint settings The `completionHandler` will be notified when the remote endpoint has acknowledged the settings.

  - ### 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

    - #### HttpConnection(java.lang.Object delegate)

  - ### Method Detail

    - #### void close()

      Close the connection and all the currently active streams.

      An HTTP/2 connection will send a frame before.

    - #### HttpConnection closeHandler(io.vertx.core.Handler<java.lang.Void> handler)

      Set a close handler. The handler will get notified when the connection is closed.

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

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

      Set an handler called when a connection error happens

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

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

    - #### int getWindowSize()

      Returns:
        the current connection window size or `-1` for HTTP/1.x

    - #### HttpConnection goAway(long errorCode)

      Like HttpConnection.goAway with a last stream id `2^31-1`.

      Returns:
      Parameters:
        errorCode

    - #### HttpConnection goAway(long errorCode, int lastStreamId)

      Like HttpConnection.goAway with no buffer.

      Returns:
      Parameters:
        errorCode
        lastStreamId

    - #### HttpConnection goAway(long errorCode, int lastStreamId, Buffer debugData)

      Send a go away frame to the remote endpoint of the connection.

      - a frame is sent to the to the remote endpoint with the `errorCode` and `debugData`
      - any stream created after the stream identified by `lastStreamId` will be closed
      - for an is different than `0` when all the remaining streams are closed this connection will be closed automatically

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `errorCode` - the error code
        `lastStreamId` - the last stream id
        `debugData` - additional debug data sent to the remote endpoint

    - #### HttpConnection goAwayHandler(io.vertx.core.Handler<java.util.Map<java.lang.String, java.lang.Object>> handler)

      Set an handler called when a frame is received.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `handler` - the handler

    - #### HttpConnection ping(Buffer data, io.vertx.core.Handler<io.vertx.core.AsyncResult<Buffer>> pongHandler)

      Send a frame to the remote endpoint.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `data` - the 8 bytes data of the frame
        `pongHandler` - an async result handler notified with pong reply or the failure

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

      Set an handler notified when a frame is received from the remote endpoint.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `handler` - the handler to be called when a is received

    - #### java.util.Map<java.lang.String, java.lang.Object> remoteSettings()

      Returns:
        the current remote endpoint settings for this connection - this is not implemented for HTTP/1.x (see Http2Settings)

    - #### HttpConnection remoteSettingsHandler(io.vertx.core.Handler<java.util.Map<java.lang.String, java.lang.Object>> handler)

      Set an handler that is called when remote endpoint Http2Settings are updated.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `handler` - the handler for remote endpoint settings

    - #### HttpConnection setWindowSize(int windowSize)

      Update the current connection wide window size to a new size.

      Increasing this value, gives better performance when several data streams are multiplexed

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `windowSize` - the new window size

    - #### java.util.Map<java.lang.String, java.lang.Object> settings()

      Returns:
        the latest server settings acknowledged by the remote endpoint - this is not implemented for HTTP/1.x (see Http2Settings)

    - #### HttpConnection shutdown()

      Initiate a connection shutdown, a go away frame is sent and the connection is closed when all current active streams are closed or after a time out of 30 seconds.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently

    - #### HttpConnection shutdown(long timeoutMs)

      Initiate a connection shutdown, a go away frame is sent and the connection is closed when all current streams will be closed or the `timeout` is fired.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `timeoutMs` - the timeout in milliseconds

    - #### HttpConnection shutdownHandler(io.vertx.core.Handler<java.lang.Void> handler)

      Set an handler called when a frame has been sent or received and all connections are closed.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `handler` - the handler

    - #### HttpConnection updateSettings(java.util.Map<java.lang.String, java.lang.Object> settings = [:])

      Send to the remote endpoint an update of the server settings.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `settings` - the new settings (see Http2Settings)

    - #### HttpConnection updateSettings(java.util.Map<java.lang.String, java.lang.Object> settings = [:], io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> completionHandler)

      Send to the remote endpoint an update of this endpoint settings

      The `completionHandler` will be notified when the remote endpoint has acknowledged the settings.

      This is not implemented for HTTP/1.x.
      Returns:
        a reference to this, so the API can be used fluently
      Parameters:
        `settings` - the new settings (see Http2Settings)
        `completionHandler` - the handler notified when the settings have been acknowledged by the remote endpoint