Package io.vertx.rxjava3.core.http

## Class HttpServerResponse

- java.lang.Object
- - io.vertx.rxjava3.core.http.HttpServerResponse

- All Implemented Interfaces:
    `io.vertx.lang.rx.RxDelegate`, `StreamBase`, `WriteStream<Buffer>`

      public class HttpServerResponse
      extends Object
      implements io.vertx.lang.rx.RxDelegate, WriteStream<Buffer>

  Represents a server-side HTTP response.

  An instance of this is created and associated to every instance of `HttpServerRequest` that.

  It allows the developer to control the HTTP response that is sent back to the client for a particular HTTP request.

  It contains methods that allow HTTP headers and trailers to be set, and for a body to be written out to the response.

  It also allows files to be streamed by the kernel directly from disk to the outgoing HTTP connection, bypassing user space altogether (where supported by the underlying operating system). This is a very efficient way of serving files from the server since buffers do not have to be read one by one from the file and written to the outgoing socket. If the developer wants to use directly a `FileChannel` and manage its lifecycle use `sendFile(java.lang.String)`. This is not yet supported in HTTP/2 for `Http2ServerResponse`.

  It implements `WriteStream` so it can be used with `Pipe` to pipe data with flow control.

  Any response should end with a terminal action, which are `end(java.lang.String)` or `sendFile(java.lang.String)` for successful completion of the request, or `reset()` for erroneous completion of the request, so you can only call one of the three methods as the last step in dealing with your response, but you must call one of the three methods.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<HttpServerResponse>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HttpServerResponse​(HttpServerResponse delegate)` |
    `HttpServerResponse​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `HttpServerResponse` | `addCookie​(Cookie cookie)` | Add a cookie.
    `HttpServerResponse` | `bodyEndHandler​(Handler<Void> handler)` | Provides a handler that will be called after the last part of the body is written to the wire.
    `long` | `bytesWritten()` |
    `boolean` | `closed()` |
    `HttpServerResponse` | `closeHandler​(Handler<Void> handler)` | Set a close handler for the response, this is called when the underlying connection is closed and the response was still using the connection.
    `HttpServerResponse` | `drainHandler​(Handler<Void> handler)` | Set a drain handler on the stream.
    `Completable` | `end()` | Ends the response.
    `Completable` | `end​(Buffer chunk)` | Same as `end(java.lang.String)` but writes some data to the response body before ending.
    `Completable` | `end​(String chunk)` | Same as `end(java.lang.String)` but writes a String in UTF-8 encoding before ending the response.
    `Completable` | `end​(String chunk, String enc)` | Same as `end(java.lang.String)` but writes a String with the specified encoding before ending the response.
    `boolean` | `ended()` |
    `HttpServerResponse` | `endHandler​(Handler<Void> handler)` | Set an end handler for the response.
    `boolean` | `equals​(Object o)` |
    `HttpServerResponse` | `exceptionHandler​(Handler<Throwable> handler)` | Set an exception handler on the write stream.
    `HttpServerResponse` | `getDelegate()` |
    `int` | `getStatusCode()` |
    `String` | `getStatusMessage()` |
    `int` | `hashCode()` |
    `MultiMap` | `headers()` |
    `HttpServerResponse` | `headersEndHandler​(Handler<Void> handler)` | Provide a handler that will be called just before the headers are written to the wire.
    `boolean` | `headWritten()` |
    `boolean` | `isChunked()` |
    `static HttpServerResponse` | `newInstance​(HttpServerResponse arg)` |
    `Single<HttpServerResponse>` | `push​(HttpMethod method, HostAndPort authority, String path)` | Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with no headers.
    `Single<HttpServerResponse>` | `push​(HttpMethod method, HostAndPort authority, String path, MultiMap headers)` | Push a response to the client.
    `Single<HttpServerResponse>` | `push​(HttpMethod method, String path)` | Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
    `Single<HttpServerResponse>` | `push​(HttpMethod method, String path, MultiMap headers)` | Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
    `HttpServerResponse` | `putHeader​(CharSequence name, CharSequence value)` | Like `putHeader(java.lang.String, java.lang.String)` but using CharSequence
    `HttpServerResponse` | `putHeader​(CharSequence name, Iterable<CharSequence> values)` | Like `putHeader(java.lang.String, java.lang.String)` but with CharSequence Iterable
    `HttpServerResponse` | `putHeader​(String name, Iterable<String> values)` | Like `putHeader(java.lang.String, java.lang.String)` but providing multiple values via a String Iterable
    `HttpServerResponse` | `putHeader​(String name, String value)` | Put an HTTP header
    `HttpServerResponse` | `putTrailer​(CharSequence name, CharSequence value)` | Like `putTrailer(java.lang.String, java.lang.String)` but using CharSequence
    `HttpServerResponse` | `putTrailer​(CharSequence name, Iterable<CharSequence> value)` | Like `putTrailer(java.lang.String, java.lang.String)` but with CharSequence Iterable
    `HttpServerResponse` | `putTrailer​(String name, Iterable<String> values)` | Like `putTrailer(java.lang.String, java.lang.String)` but providing multiple values via a String Iterable
    `HttpServerResponse` | `putTrailer​(String name, String value)` | Put an HTTP trailer
    `Cookie` | `removeCookie​(String name)` | Expire a cookie, notifying a User Agent to remove it from its cookie jar.
    `Cookie` | `removeCookie​(String name, boolean invalidate)` | Remove a cookie from the cookie set.
    `Cookie` | `removeCookie​(String name, String domain, String path)` | Expires a cookie from the cookie set.
    `Cookie` | `removeCookie​(String name, String domain, String path, boolean invalidate)` | Remove a cookie from the cookie set.
    `Set<Cookie>` | `removeCookies​(String name)` | Expire all cookies, notifying a User Agent to remove it from its cookie jar.
    `Set<Cookie>` | `removeCookies​(String name, boolean invalidate)` | Remove all cookies from the cookie set.
    `Completable` | `reset()` | Equivalent to calling `reset()` with `0`.
    `Completable` | `reset​(long code)` | Reset this response:
    `Completable` | `rxEnd()` | Ends the response.
    `Completable` | `rxEnd​(Buffer chunk)` | Same as `end(java.lang.String)` but writes some data to the response body before ending.
    `Completable` | `rxEnd​(String chunk)` | Same as `end(java.lang.String)` but writes a String in UTF-8 encoding before ending the response.
    `Completable` | `rxEnd​(String chunk, String enc)` | Same as `end(java.lang.String)` but writes a String with the specified encoding before ending the response.
    `Single<HttpServerResponse>` | `rxPush​(HttpMethod method, HostAndPort authority, String path)` | Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with no headers.
    `Single<HttpServerResponse>` | `rxPush​(HttpMethod method, HostAndPort authority, String path, MultiMap headers)` | Push a response to the client.
    `Single<HttpServerResponse>` | `rxPush​(HttpMethod method, String path)` | Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
    `Single<HttpServerResponse>` | `rxPush​(HttpMethod method, String path, MultiMap headers)` | Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
    `Completable` | `rxReset()` | Equivalent to calling `reset()` with `0`.
    `Completable` | `rxReset​(long code)` | Reset this response:
    `Completable` | `rxSend()` | Send the request with an empty body.
    `Completable` | `rxSend​(Flowable<Buffer> body)` | Send the request with a stream `body`.
    `Completable` | `rxSend​(Buffer body)` | Send the request with a buffer `body`.
    `Completable` | `rxSend​(String body)` | Send the request with a string `body`.
    `Completable` | `rxSendFile​(RandomAccessFile file)` | Same as `sendFile(java.lang.String)` with
    `Completable` | `rxSendFile​(RandomAccessFile file, long offset)` | Same as `sendFile(java.lang.String)` with
    `Completable` | `rxSendFile​(RandomAccessFile file, long offset, long length)` | Same as `sendFile(java.lang.String)` with
    `Completable` | `rxSendFile​(String filename)` | Send the request with a stream `body`.
    `Completable` | `rxSendFile​(String filename, long offset)` | Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.
    `Completable` | `rxSendFile​(String filename, long offset, long length)` | Ask the OS to stream a file as specified by `filename` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.
    `Completable` | `rxSendFile​(FileChannel channel)` | Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.
    `Completable` | `rxSendFile​(FileChannel channel, long offset)` | Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.
    `Completable` | `rxSendFile​(FileChannel channel, long offset, long length)` | Ask the OS to stream a file as specified by `channel` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system).
    `Completable` | `rxWrite​(Buffer data)` | Write some data to the stream.
    `Completable` | `rxWrite​(String chunk)` | Write a `String` to the response body, encoded in UTF-8.
    `Completable` | `rxWrite​(String chunk, String enc)` | Write a `String` to the response body, encoded using the encoding `enc`.
    `Completable` | `rxWriteContinue()` | Used to write an interim 100 Continue response to signify that the client should send the rest of the request.
    `Completable` | `rxWriteCustomFrame​(int type, int flags, Buffer payload)` | Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.
    `Completable` | `rxWriteCustomFrame​(HttpFrame frame)` | Like `writeCustomFrame(int, int, io.vertx.core.buffer.Buffer)` but with an `HttpFrame`.
    `Completable` | `rxWriteEarlyHints​(MultiMap headers)` | Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.
    `Completable` | `rxWriteHead()` | Send the response headers.
    `Completable` | `send()` | Send the request with an empty body.
    `Completable` | `send​(Flowable<Buffer> body)` | Send the request with a stream `body`.
    `Completable` | `send​(Buffer body)` | Send the request with a buffer `body`.
    `Completable` | `send​(String body)` | Send the request with a string `body`.
    `Completable` | `sendFile​(RandomAccessFile file)` | Same as `sendFile(java.lang.String)` with
    `Completable` | `sendFile​(RandomAccessFile file, long offset)` | Same as `sendFile(java.lang.String)` with
    `Completable` | `sendFile​(RandomAccessFile file, long offset, long length)` | Same as `sendFile(java.lang.String)` with
    `Completable` | `sendFile​(String filename)` | Send the request with a stream `body`.
    `Completable` | `sendFile​(String filename, long offset)` | Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.
    `Completable` | `sendFile​(String filename, long offset, long length)` | Ask the OS to stream a file as specified by `filename` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.
    `Completable` | `sendFile​(FileChannel channel)` | Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.
    `Completable` | `sendFile​(FileChannel channel, long offset)` | Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.
    `Completable` | `sendFile​(FileChannel channel, long offset, long length)` | Ask the OS to stream a file as specified by `channel` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system).
    `HttpServerResponse` | `setChunked​(boolean chunked)` | If `chunked` is `true`, this response will use HTTP chunked encoding, and each call to write to the body will correspond to a new HTTP chunk sent on the wire.
    `HttpServerResponse` | `setStatusCode​(int statusCode)` | Set the status code.
    `HttpServerResponse` | `setStatusMessage​(String statusMessage)` | Set the status message
    `HttpServerResponse` | `setStreamPriority​(StreamPriority streamPriority)` | Sets the priority of the associated stream
    `HttpServerResponse` | `setWriteQueueMaxSize​(int maxSize)` | Set the maximum size of the write queue to `maxSize`.
    `int` | `streamId()` |
    `WriteStreamObserver<Buffer>` | `toObserver()` |
    `String` | `toString()` |
    `WriteStreamSubscriber<Buffer>` | `toSubscriber()` |
    `MultiMap` | `trailers()` |
    `Completable` | `write​(Buffer data)` | Write some data to the stream.
    `Completable` | `write​(String chunk)` | Write a `String` to the response body, encoded in UTF-8.
    `Completable` | `write​(String chunk, String enc)` | Write a `String` to the response body, encoded using the encoding `enc`.
    `Completable` | `writeContinue()` | Used to write an interim 100 Continue response to signify that the client should send the rest of the request.
    `Completable` | `writeCustomFrame​(int type, int flags, Buffer payload)` | Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.
    `Completable` | `writeCustomFrame​(HttpFrame frame)` | Like `writeCustomFrame(int, int, io.vertx.core.buffer.Buffer)` but with an `HttpFrame`.
    `Completable` | `writeEarlyHints​(MultiMap headers)` | Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.
    `Completable` | `writeHead()` | Send the response headers.
    `boolean` | `writeQueueFull()` | This will return `true` if there are more bytes in the write queue than the value set using `setWriteQueueMaxSize(int)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<HttpServerResponse> __TYPE_ARG

  - ### Constructor Detail

    - #### HttpServerResponse

          public HttpServerResponse​(HttpServerResponse delegate)

    - #### HttpServerResponse

          public HttpServerResponse​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public HttpServerResponse getDelegate()

      Specified by:
        `getDelegate` in interface `io.vertx.lang.rx.RxDelegate`
      Specified by:
        `getDelegate` in interface `StreamBase`
      Specified by:
        `getDelegate` in interface `WriteStream<Buffer>`

    - #### toObserver

          public WriteStreamObserver<Buffer> toObserver()

      Specified by:
        `toObserver` in interface `WriteStream<Buffer>`

    - #### toSubscriber

          public WriteStreamSubscriber<Buffer> toSubscriber()

      Specified by:
        `toSubscriber` in interface `WriteStream<Buffer>`

    - #### write

          public Completable write​(Buffer data)

      Write some data to the stream.

      The data is usually put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the `WriteStream.writeQueueFull()` method before writing. This is done automatically if using a .

      When the `data` is moved from the queue to the actual medium, the returned will be completed with the write result, e.g the future is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.

      Specified by:
        `write` in interface `WriteStream<Buffer>`
      Parameters:
        `data` - the data to write
      Returns:
        a future completed with the write result

    - #### rxWrite

          public Completable rxWrite​(Buffer data)

      Write some data to the stream.

      The data is usually put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the `WriteStream.writeQueueFull()` method before writing. This is done automatically if using a .

      When the `data` is moved from the queue to the actual medium, the returned will be completed with the write result, e.g the future is succeeded when a server HTTP response buffer is written to the socket and failed if the remote client has closed the socket while the data was still pending for write.

      Specified by:
        `rxWrite` in interface `WriteStream<Buffer>`
      Parameters:
        `data` - the data to write
      Returns:
        a future completed with the write result

    - #### writeQueueFull

          public boolean writeQueueFull()

      This will return `true` if there are more bytes in the write queue than the value set using `setWriteQueueMaxSize(int)`
      Specified by:
        `writeQueueFull` in interface `WriteStream<Buffer>`
      Returns:
        `true` if write queue is full

    - #### exceptionHandler

          public HttpServerResponse exceptionHandler​(Handler<Throwable> handler)

      Description copied from interface: `WriteStream`
      Set an exception handler on the write stream.
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Specified by:
        `exceptionHandler` in interface `WriteStream<Buffer>`
      Parameters:
        `handler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### setWriteQueueMaxSize

          public HttpServerResponse setWriteQueueMaxSize​(int maxSize)

      Description copied from interface: `WriteStream`
      Set the maximum size of the write queue to `maxSize`. You will still be able to write to the stream even if there is more than `maxSize` items in the write queue. This is used as an indicator by classes such as `Pipe` to provide flow control.

      The value is defined by the implementation of the stream, e.g in bytes for a `NetSocket`, etc...
      Specified by:
        `setWriteQueueMaxSize` in interface `WriteStream<Buffer>`
      Parameters:
        `maxSize` - the max size of the write stream
      Returns:
        a reference to this, so the API can be used fluently

    - #### drainHandler

          public HttpServerResponse drainHandler​(Handler<Void> handler)

      Description copied from interface: `WriteStream`
      Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See `Pipe` for an example of this being used.

      The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to `maxSize / 2`.

      Specified by:
        `drainHandler` in interface `WriteStream<Buffer>`
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### getStatusCode

          public int getStatusCode()

      Returns:
        the HTTP status code of the response. The default is `200` representing `OK`.

    - #### setStatusCode

          public HttpServerResponse setStatusCode​(int statusCode)

      Set the status code. If the status message hasn't been explicitly set, a default status message corresponding to the code will be looked-up and used.
      Parameters:
        `statusCode` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### getStatusMessage

          public String getStatusMessage()

      Returns:
        the HTTP status message of the response. If this is not specified a default value will be used depending on what `setStatusCode(int)` has been set to.

    - #### setStatusMessage

          public HttpServerResponse setStatusMessage​(String statusMessage)

      Set the status message
      Parameters:
        `statusMessage` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### setChunked

          public HttpServerResponse setChunked​(boolean chunked)

      If `chunked` is `true`, this response will use HTTP chunked encoding, and each call to write to the body will correspond to a new HTTP chunk sent on the wire.

      If chunked encoding is used the HTTP header `Transfer-Encoding` with a value of `Chunked` will be automatically inserted in the response.

      If `chunked` is `false`, this response will not use HTTP chunked encoding, and therefore the total size of any data that is written in the respone body must be set in the `Content-Length` header before any data is written out.

      An HTTP chunked response is typically used when you do not know the total size of the request body up front.

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

    - #### isChunked

          public boolean isChunked()

      Returns:
        is the response chunked?

    - #### headers

          public MultiMap headers()

      Returns:
        The HTTP headers

    - #### putHeader

          public HttpServerResponse putHeader​(String name,
                                              String value)

      Put an HTTP header
      Parameters:
        `name` - the header name
        `value` - the header value.
      Returns:
        a reference to this, so the API can be used fluently

    - #### trailers

          public MultiMap trailers()

      Returns:
        The HTTP trailers

    - #### putTrailer

          public HttpServerResponse putTrailer​(String name,
                                               String value)

      Put an HTTP trailer
      Parameters:
        `name` - the trailer name
        `value` - the trailer value
      Returns:
        a reference to this, so the API can be used fluently

    - #### closeHandler

          public HttpServerResponse closeHandler​(Handler<Void> handler)

      Set a close handler for the response, this is called when the underlying connection is closed and the response was still using the connection.

      For HTTP/1.x it is called when the connection is closed before `end()` is called, therefore it is not guaranteed to be called.

      For HTTP/2 it is called when the related stream is closed, and therefore it will be always be called.

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

    - #### endHandler

          public HttpServerResponse endHandler​(Handler<Void> handler)

      Set an end handler for the response. This will be called when the response is disposed to allow consistent cleanup of the response.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### writeHead

          public Completable writeHead()

      Send the response headers.
      Returns:
        a future notified by the success or failure of the write

    - #### rxWriteHead

          public Completable rxWriteHead()

      Send the response headers.
      Returns:
        a future notified by the success or failure of the write

    - #### write

          public Completable write​(String chunk,
                                   String enc)

      Write a `String` to the response body, encoded using the encoding `enc`.
      Parameters:
        `chunk` - the string to write
        `enc` - the encoding to use
      Returns:
        a future completed with the body result

    - #### rxWrite

          public Completable rxWrite​(String chunk,
                                     String enc)

      Write a `String` to the response body, encoded using the encoding `enc`.
      Parameters:
        `chunk` - the string to write
        `enc` - the encoding to use
      Returns:
        a future completed with the body result

    - #### write

          public Completable write​(String chunk)

      Write a `String` to the response body, encoded in UTF-8.
      Parameters:
        `chunk` - the string to write
      Returns:
        a future completed with the body result

    - #### rxWrite

          public Completable rxWrite​(String chunk)

      Write a `String` to the response body, encoded in UTF-8.
      Parameters:
        `chunk` - the string to write
      Returns:
        a future completed with the body result

    - #### writeContinue

          public Completable writeContinue()

      Used to write an interim 100 Continue response to signify that the client should send the rest of the request. Must only be used if the request contains an "Expect:100-Continue" header
      Returns:
        a reference to this, so the API can be used fluently

    - #### rxWriteContinue

          public Completable rxWriteContinue()

      Used to write an interim 100 Continue response to signify that the client should send the rest of the request. Must only be used if the request contains an "Expect:100-Continue" header
      Returns:
        a reference to this, so the API can be used fluently

    - #### writeEarlyHints

          public Completable writeEarlyHints​(MultiMap headers)

      Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.
      Parameters:
        `headers` - headers to write
      Returns:
        a future

    - #### rxWriteEarlyHints

          public Completable rxWriteEarlyHints​(MultiMap headers)

      Used to write an interim 103 Early Hints response to return some HTTP headers before the final HTTP message.
      Parameters:
        `headers` - headers to write
      Returns:
        a future

    - #### end

          public Completable end​(String chunk)

      Same as `end(java.lang.String)` but writes a String in UTF-8 encoding before ending the response.
      Parameters:
        `chunk` - the string to write before ending the response
      Returns:
        a future completed with the body result

    - #### rxEnd

          public Completable rxEnd​(String chunk)

      Same as `end(java.lang.String)` but writes a String in UTF-8 encoding before ending the response.
      Parameters:
        `chunk` - the string to write before ending the response
      Returns:
        a future completed with the body result

    - #### end

          public Completable end​(String chunk,
                                 String enc)

      Same as `end(java.lang.String)` but writes a String with the specified encoding before ending the response.
      Parameters:
        `chunk` - the string to write before ending the response
        `enc` - the encoding to use
      Returns:
        a future completed with the body result

    - #### rxEnd

          public Completable rxEnd​(String chunk,
                                   String enc)

      Same as `end(java.lang.String)` but writes a String with the specified encoding before ending the response.
      Parameters:
        `chunk` - the string to write before ending the response
        `enc` - the encoding to use
      Returns:
        a future completed with the body result

    - #### end

          public Completable end​(Buffer chunk)

      Same as `end(java.lang.String)` but writes some data to the response body before ending. If the response is not chunked and no other data has been written then the @code{Content-Length} header will be automatically set.
      Specified by:
        `end` in interface `WriteStream<Buffer>`
      Parameters:
        `chunk` - the buffer to write before ending the response
      Returns:
        a future completed with the body result

    - #### rxEnd

          public Completable rxEnd​(Buffer chunk)

      Same as `end(java.lang.String)` but writes some data to the response body before ending. If the response is not chunked and no other data has been written then the @code{Content-Length} header will be automatically set.
      Specified by:
        `rxEnd` in interface `WriteStream<Buffer>`
      Parameters:
        `chunk` - the buffer to write before ending the response
      Returns:
        a future completed with the body result

    - #### end

          public Completable end()

      Ends the response. If no data has been written to the response body, the actual response won't get written until this method gets called.

      Once the response has ended, it cannot be used any more.

      This is a terminal action, like `sendFile(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Specified by:
        `end` in interface `WriteStream<Buffer>`
      Returns:
        a future completed with the body result

    - #### rxEnd

          public Completable rxEnd()

      Ends the response. If no data has been written to the response body, the actual response won't get written until this method gets called.

      Once the response has ended, it cannot be used any more.

      This is a terminal action, like `sendFile(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Specified by:
        `rxEnd` in interface `WriteStream<Buffer>`
      Returns:
        a future completed with the body result

    - #### send

          public Completable send()

      Send the request with an empty body.
      Returns:
        a future notified when the response has been written

    - #### rxSend

          public Completable rxSend()

      Send the request with an empty body.
      Returns:
        a future notified when the response has been written

    - #### send

          public Completable send​(String body)

      Send the request with a string `body`.
      Parameters:
        `body` -
      Returns:
        a future notified when the response has been written

    - #### rxSend

          public Completable rxSend​(String body)

      Send the request with a string `body`.
      Parameters:
        `body` -
      Returns:
        a future notified when the response has been written

    - #### send

          public Completable send​(Buffer body)

      Send the request with a buffer `body`.
      Parameters:
        `body` -
      Returns:
        a future notified when the response has been written

    - #### rxSend

          public Completable rxSend​(Buffer body)

      Send the request with a buffer `body`.
      Parameters:
        `body` -
      Returns:
        a future notified when the response has been written

    - #### send

          public Completable send​(Flowable<Buffer> body)

      Send the request with a stream `body`.

      If the `HttpHeaders` is set then the request assumes this is the length of the {stream}, otherwise the request will set a chunked `HttpHeaders`.

      Parameters:
        `body` -
      Returns:
        a future notified when the last bytes of the response was sent

    - #### rxSend

          public Completable rxSend​(Flowable<Buffer> body)

      Send the request with a stream `body`.

      If the `HttpHeaders` is set then the request assumes this is the length of the {stream}, otherwise the request will set a chunked `HttpHeaders`.

      Parameters:
        `body` -
      Returns:
        a future notified when the last bytes of the response was sent

    - #### sendFile

          public Completable sendFile​(String filename)

      Send the request with a stream `body`.

      If the `HttpHeaders` is set then the request assumes this is the length of the {stream}, otherwise the request will set a chunked `HttpHeaders`.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `filename` -
      Returns:
        a future notified when the response has been written

    - #### rxSendFile

          public Completable rxSendFile​(String filename)

      Send the request with a stream `body`.

      If the `HttpHeaders` is set then the request assumes this is the length of the {stream}, otherwise the request will set a chunked `HttpHeaders`.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `filename` -
      Returns:
        a future notified when the response has been written

    - #### sendFile

          public Completable sendFile​(String filename,
                                      long offset)

      Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `filename` - path to the file to serve
        `offset` - offset to start serving from
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(String filename,
                                        long offset)

      Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `filename` - path to the file to serve
        `offset` - offset to start serving from
      Returns:
        a future completed with the body result

    - #### sendFile

          public Completable sendFile​(String filename,
                                      long offset,
                                      long length)

      Ask the OS to stream a file as specified by `filename` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to serve files.

      The actual serve is asynchronous and may not complete until some time after this method has returned.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `filename` - path to the file to serve
        `offset` - offset to start serving from
        `length` - the number of bytes to send
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(String filename,
                                        long offset,
                                        long length)

      Ask the OS to stream a file as specified by `filename` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to serve files.

      The actual serve is asynchronous and may not complete until some time after this method has returned.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `filename` - path to the file to serve
        `offset` - offset to start serving from
        `length` - the number of bytes to send
      Returns:
        a future completed with the body result

    - #### ended

          public boolean ended()

      Returns:
        has the response already ended?

    - #### closed

          public boolean closed()

      Returns:
        has the underlying TCP connection corresponding to the request already been closed?

    - #### headWritten

          public boolean headWritten()

      Returns:
        have the headers for the response already been written?

    - #### headersEndHandler

          public HttpServerResponse headersEndHandler​(Handler<Void> handler)

      Provide a handler that will be called just before the headers are written to the wire.

      This provides a hook allowing you to add any more headers or do any more operations before this occurs.

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

    - #### bodyEndHandler

          public HttpServerResponse bodyEndHandler​(Handler<Void> handler)

      Provides a handler that will be called after the last part of the body is written to the wire. The handler is called asynchronously of when the response has been received by the client. This provides a hook allowing you to do more operations once the request has been sent over the wire such as resource cleanup.
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### bytesWritten

          public long bytesWritten()

      Returns:
        the total number of bytes written for the body of the response.

    - #### streamId

          public int streamId()

      Returns:
        the id of the stream of this response, for HTTP/1.x

    - #### push

          public Single<HttpServerResponse> push​(HttpMethod method,
                                                 HostAndPort authority,
                                                 String path)

      Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with no headers.
      Parameters:
        `method` -
        `authority` -
        `path` -
      Returns:

    - #### rxPush

          public Single<HttpServerResponse> rxPush​(HttpMethod method,
                                                   HostAndPort authority,
                                                   String path)

      Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with no headers.
      Parameters:
        `method` -
        `authority` -
        `path` -
      Returns:

    - #### push

          public Single<HttpServerResponse> push​(HttpMethod method,
                                                 String path,
                                                 MultiMap headers)

      Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
      Parameters:
        `method` -
        `path` -
        `headers` -
      Returns:

    - #### rxPush

          public Single<HttpServerResponse> rxPush​(HttpMethod method,
                                                   String path,
                                                   MultiMap headers)

      Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
      Parameters:
        `method` -
        `path` -
        `headers` -
      Returns:

    - #### push

          public Single<HttpServerResponse> push​(HttpMethod method,
                                                 String path)

      Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
      Parameters:
        `method` -
        `path` -
      Returns:

    - #### rxPush

          public Single<HttpServerResponse> rxPush​(HttpMethod method,
                                                   String path)

      Like `push(io.vertx.core.http.HttpMethod, io.vertx.core.net.HostAndPort, java.lang.String)` with the host copied from the current request.
      Parameters:
        `method` -
        `path` -
      Returns:

    - #### push

          public Single<HttpServerResponse> push​(HttpMethod method,
                                                 HostAndPort authority,
                                                 String path,
                                                 MultiMap headers)

      Push a response to the client.

      The `handler` will be notified with a success when the push can be sent and with a failure when the client has disabled push or reset the push before it has been sent.

      The `handler` may be queued if the client has reduced the maximum number of streams the server can push concurrently.

      Push can be sent only for peer initiated streams and if the response is not ended.
      Parameters:
        `method` - the method of the promised request
        `authority` - the authority of the promised request
        `path` - the path of the promised request
        `headers` - the headers of the promised request
      Returns:
        a future notified when the response can be written

    - #### rxPush

          public Single<HttpServerResponse> rxPush​(HttpMethod method,
                                                   HostAndPort authority,
                                                   String path,
                                                   MultiMap headers)

      Push a response to the client.

      The `handler` will be notified with a success when the push can be sent and with a failure when the client has disabled push or reset the push before it has been sent.

      The `handler` may be queued if the client has reduced the maximum number of streams the server can push concurrently.

      Push can be sent only for peer initiated streams and if the response is not ended.
      Parameters:
        `method` - the method of the promised request
        `authority` - the authority of the promised request
        `path` - the path of the promised request
        `headers` - the headers of the promised request
      Returns:
        a future notified when the response can be written

    - #### reset

          public Completable reset()

      Equivalent to calling `reset()` with `0`.
      Returns:

    - #### rxReset

          public Completable rxReset()

      Equivalent to calling `reset()` with `0`.
      Returns:

    - #### reset

          public Completable reset​(long code)

      Reset this response:

      - for HTTP/2, send an HTTP/2 reset frame with the specified error `code`
      - for HTTP/1.x, close the connection when the current response has not yet been sent

      When the response has already been sent nothing happens and `false` is returned as indicator.

      This is a terminal action, like `end(java.lang.String)` and `sendFile(java.lang.String)`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `code` - the error code
      Returns:
        `true` when reset has been performed

    - #### rxReset

          public Completable rxReset​(long code)

      Reset this response:

      - for HTTP/2, send an HTTP/2 reset frame with the specified error `code`
      - for HTTP/1.x, close the connection when the current response has not yet been sent

      When the response has already been sent nothing happens and `false` is returned as indicator.

      This is a terminal action, like `end(java.lang.String)` and `sendFile(java.lang.String)`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `code` - the error code
      Returns:
        `true` when reset has been performed

    - #### writeCustomFrame

          public Completable writeCustomFrame​(int type,
                                              int flags,
                                              Buffer payload)

      Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.

      The frame is sent immediatly and is not subject to flow control.

      Parameters:
        `type` - the 8-bit frame type
        `flags` - the 8-bit frame flags
        `payload` - the frame payload
      Returns:
        a reference to this, so the API can be used fluently

    - #### rxWriteCustomFrame

          public Completable rxWriteCustomFrame​(int type,
                                                int flags,
                                                Buffer payload)

      Write an HTTP/2 frame to the response, allowing to extend the HTTP/2 protocol.

      The frame is sent immediatly and is not subject to flow control.

      Parameters:
        `type` - the 8-bit frame type
        `flags` - the 8-bit frame flags
        `payload` - the frame payload
      Returns:
        a reference to this, so the API can be used fluently

    - #### writeCustomFrame

          public Completable writeCustomFrame​(HttpFrame frame)

      Like `writeCustomFrame(int, int, io.vertx.core.buffer.Buffer)` but with an `HttpFrame`.
      Parameters:
        `frame` - the frame to write
      Returns:

    - #### rxWriteCustomFrame

          public Completable rxWriteCustomFrame​(HttpFrame frame)

      Like `writeCustomFrame(int, int, io.vertx.core.buffer.Buffer)` but with an `HttpFrame`.
      Parameters:
        `frame` - the frame to write
      Returns:

    - #### setStreamPriority

          public HttpServerResponse setStreamPriority​(StreamPriority streamPriority)

      Sets the priority of the associated stream

      This is not implemented for HTTP/1.x.
      Parameters:
        `streamPriority` - the priority for this request's stream
      Returns:

    - #### addCookie

          public HttpServerResponse addCookie​(Cookie cookie)

      Add a cookie. This will be sent back to the client in the response.
      Parameters:
        `cookie` - the cookie
      Returns:
        a reference to this, so the API can be used fluently

    - #### removeCookie

          public Cookie removeCookie​(String name)

      Expire a cookie, notifying a User Agent to remove it from its cookie jar. NOTE: This method will only remove the first occurrence of the given name. Users probably may want to use: `removeCookies(java.lang.String)`
      Parameters:
        `name` - the name of the cookie
      Returns:
        the cookie, if it existed, or null

    - #### removeCookie

          public Cookie removeCookie​(String name,
                                     boolean invalidate)

      Remove a cookie from the cookie set. If invalidate is `true` then it will expire a cookie, notifying a User Agent to remove it from its cookie jar. NOTE: This method will only expire the first occurrence of the given name. Users probably may want to use: `removeCookies(java.lang.String)`
      Parameters:
        `name` - the name of the cookie
        `invalidate` -
      Returns:
        the cookie, if it existed, or `null`

    - #### removeCookies

          public Set<Cookie> removeCookies​(String name)

      Expire all cookies, notifying a User Agent to remove it from its cookie jar. NOTE: the returned is read-only. This means any attempt to modify (add or remove to the set), will throw `UnsupportedOperationException`.
      Parameters:
        `name` - the name of the cookie
      Returns:
        a read only set of affected cookies, if they existed, or an empty set.

    - #### removeCookies

          public Set<Cookie> removeCookies​(String name,
                                           boolean invalidate)

      Remove all cookies from the cookie set. If invalidate is `true` then it will expire a cookie, notifying a User Agent to remove it from its cookie jar. NOTE: the returned is read-only. This means any attempt to modify (add or remove to the set), will throw `UnsupportedOperationException`.
      Parameters:
        `name` - the name of the cookie
        `invalidate` - invalidate from the user agent
      Returns:
        a read only set of affected cookies, if they existed, or an empty set.

    - #### removeCookie

          public Cookie removeCookie​(String name,
                                     String domain,
                                     String path)

      Expires a cookie from the cookie set. This will notify a User Agent to remove it from its cookie jar.
      Parameters:
        `name` - the name of the cookie
        `domain` - the domain of the cookie
        `path` - the path of the cookie
      Returns:
        the cookie, if it existed, or `null`

    - #### removeCookie

          public Cookie removeCookie​(String name,
                                     String domain,
                                     String path,
                                     boolean invalidate)

      Remove a cookie from the cookie set. If invalidate is `true` then it will expire a cookie, notifying a User Agent to remove it from its cookie jar.
      Parameters:
        `name` - the name of the cookie
        `domain` - the domain of the cookie
        `path` - the path of the cookie
        `invalidate` -
      Returns:
        the cookie, if it existed, or `null`

    - #### putHeader

          public HttpServerResponse putHeader​(CharSequence name,
                                              CharSequence value)

      Like `putHeader(java.lang.String, java.lang.String)` but using CharSequence
      Parameters:
        `name` -
        `value` -
      Returns:

    - #### putHeader

          public HttpServerResponse putHeader​(String name,
                                              Iterable<String> values)

      Like `putHeader(java.lang.String, java.lang.String)` but providing multiple values via a String Iterable
      Parameters:
        `name` -
        `values` -
      Returns:

    - #### putHeader

          public HttpServerResponse putHeader​(CharSequence name,
                                              Iterable<CharSequence> values)

      Like `putHeader(java.lang.String, java.lang.String)` but with CharSequence Iterable
      Parameters:
        `name` -
        `values` -
      Returns:

    - #### putTrailer

          public HttpServerResponse putTrailer​(CharSequence name,
                                               CharSequence value)

      Like `putTrailer(java.lang.String, java.lang.String)` but using CharSequence
      Parameters:
        `name` -
        `value` -
      Returns:

    - #### putTrailer

          public HttpServerResponse putTrailer​(String name,
                                               Iterable<String> values)

      Like `putTrailer(java.lang.String, java.lang.String)` but providing multiple values via a String Iterable
      Parameters:
        `name` -
        `values` -
      Returns:

    - #### putTrailer

          public HttpServerResponse putTrailer​(CharSequence name,
                                               Iterable<CharSequence> value)

      Like `putTrailer(java.lang.String, java.lang.String)` but with CharSequence Iterable
      Parameters:
        `name` -
        `value` -
      Returns:

    - #### sendFile

          public Completable sendFile​(FileChannel channel)

      Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `channel` - the file channel to the file to serve
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(FileChannel channel)

      Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `channel` - the file channel to the file to serve
      Returns:
        a future completed with the body result

    - #### sendFile

          public Completable sendFile​(FileChannel channel,
                                      long offset)

      Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `channel` - the file channel to the file to serve
        `offset` - offset to start serving from
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(FileChannel channel,
                                        long offset)

      Same as `sendFile(java.lang.String)` using length @code{Long.MAX_VALUE} which means until the end of the file.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `channel` - the file channel to the file to serve
        `offset` - offset to start serving from
      Returns:
        a future completed with the body result

    - #### sendFile

          public Completable sendFile​(FileChannel channel,
                                      long offset,
                                      long length)

      Ask the OS to stream a file as specified by `channel` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system). Contrary to `sendFile(java.lang.String)`, the caller is responsible to close `channel` when no more needed. This is a very efficient way to serve files.

      The actual serve is asynchronous and may not complete until some time after this method has returned. The developer is responsible to set the adequate Content-Type with `putHeader(java.lang.String, java.lang.String)`. If not application/octet-stream will be set as default Content-Type.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `channel` - the file channel to the file to serve
        `offset` - offset to start serving from
        `length` - the number of bytes to send
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(FileChannel channel,
                                        long offset,
                                        long length)

      Ask the OS to stream a file as specified by `channel` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system). Contrary to `sendFile(java.lang.String)`, the caller is responsible to close `channel` when no more needed. This is a very efficient way to serve files.

      The actual serve is asynchronous and may not complete until some time after this method has returned. The developer is responsible to set the adequate Content-Type with `putHeader(java.lang.String, java.lang.String)`. If not application/octet-stream will be set as default Content-Type.

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `channel` - the file channel to the file to serve
        `offset` - offset to start serving from
        `length` - the number of bytes to send
      Returns:
        a future completed with the body result

    - #### sendFile

          public Completable sendFile​(RandomAccessFile file)

      Same as `sendFile(java.lang.String)` with

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `file` - the file to serve
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(RandomAccessFile file)

      Same as `sendFile(java.lang.String)` with

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `file` - the file to serve
      Returns:
        a future completed with the body result

    - #### sendFile

          public Completable sendFile​(RandomAccessFile file,
                                      long offset)

      Same as `sendFile(java.lang.String)` with

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `file` - the file to serve
        `offset` - offset to start serving from
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(RandomAccessFile file,
                                        long offset)

      Same as `sendFile(java.lang.String)` with

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `file` - the file to serve
        `offset` - offset to start serving from
      Returns:
        a future completed with the body result

    - #### sendFile

          public Completable sendFile​(RandomAccessFile file,
                                      long offset,
                                      long length)

      Same as `sendFile(java.lang.String)` with

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `file` - the file to serve
        `offset` - offset to start serving from
        `length` - the number of bytes to send
      Returns:
        a future completed with the body result

    - #### rxSendFile

          public Completable rxSendFile​(RandomAccessFile file,
                                        long offset,
                                        long length)

      Same as `sendFile(java.lang.String)` with

      This is a terminal action, like `end(java.lang.String)` and `reset()`, so you can only call one of the three methods as the last step in dealing with your response.

      Parameters:
        `file` - the file to serve
        `offset` - offset to start serving from
        `length` - the number of bytes to send
      Returns:
        a future completed with the body result

    - #### newInstance

          public static HttpServerResponse newInstance​(HttpServerResponse arg)