Class HttpServerResponse

  • All Implemented Interfaces:
    StreamBase, WriteStream<Buffer>

    public class HttpServerResponse
    extends Object
    implements 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.

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

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

    • Constructor Detail

      • HttpServerResponse

        public HttpServerResponse​(io.vertx.core.http.HttpServerResponse delegate)
      • HttpServerResponse

        public HttpServerResponse​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • write

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> write​(Buffer data)
        Same as but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        write in interface WriteStream<Buffer>
        Parameters:
        data -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeAndAwait

        public Void writeAndAwait​(Buffer data)
        Blocking variant of io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Specified by:
        writeAndAwait in interface WriteStream<Buffer>
        Parameters:
        data -
        Returns:
        the Void instance produced by the operation.
      • writeAndForget

        public void writeAndForget​(Buffer data)
        Variant of io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.core.streams.WriteStream#write(io.vertx.mutiny.core.buffer.Buffer) but you don't need to compose it with other operations.

        Specified by:
        writeAndForget in interface WriteStream<Buffer>
        Parameters:
        data -
      • end

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> end()
        Same as end() but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        end in interface WriteStream<Buffer>
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        public Void endAndAwait()
        Blocking variant of WriteStream.end().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Specified by:
        endAndAwait in interface WriteStream<Buffer>
        Returns:
        the Void instance produced by the operation.
      • endAndForget

        public void endAndForget()
        Variant of WriteStream.end() that ignores the result of the operation.

        This method subscribes on the result of WriteStream.end(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from WriteStream.end() but you don't need to compose it with other operations.

        Specified by:
        endAndForget in interface WriteStream<Buffer>
      • setWriteQueueMaxSize

        public HttpServerResponse setWriteQueueMaxSize​(int maxSize)
        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
      • getStatusCode

        public int getStatusCode()
        Returns:
        the HTTP status code of the response. The default is 200 representing OK.
      • setStatusCode

        public HttpServerResponse setStatusCode​(int statusCode)
        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)
        Parameters:
        statusMessage -
        Returns:
        a reference to this, so the API can be used fluently
      • setChunked

        public HttpServerResponse setChunked​(boolean chunked)
        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)
        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)
        Parameters:
        name - the trailer name
        value - the trailer value
        Returns:
        a reference to this, so the API can be used fluently
      • write

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> write​(String chunk,
                                                  String enc)
        Same as write(io.vertx.mutiny.core.buffer.Buffer) but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        chunk -
        enc -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeAndAwait

        public Void writeAndAwait​(String chunk,
                                  String enc)
        Blocking variant of write(String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        chunk -
        enc -
        Returns:
        the Void instance produced by the operation.
      • writeAndForget

        public void writeAndForget​(String chunk,
                                   String enc)
        Variant of write(String,String) that ignores the result of the operation.

        This method subscribes on the result of write(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from write(String,String) but you don't need to compose it with other operations.

        Parameters:
        chunk -
        enc -
      • write

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> write​(String chunk)
        Same as write(io.vertx.mutiny.core.buffer.Buffer) but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        chunk -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeAndAwait

        public Void writeAndAwait​(String chunk)
        Blocking variant of write(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        chunk -
        Returns:
        the Void instance produced by the operation.
      • writeAndForget

        public void writeAndForget​(String chunk)
        Variant of write(String) that ignores the result of the operation.

        This method subscribes on the result of write(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from write(String) but you don't need to compose it with other operations.

        Parameters:
        chunk -
      • writeContinue

        public HttpServerResponse writeContinue()
        Returns:
        a reference to this, so the API can be used fluently
      • writeEarlyHints

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> writeEarlyHints​(MultiMap headers)
        Same as writeEarlyHints(io.vertx.mutiny.core.MultiMap) but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        headers - headers to write
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • writeEarlyHintsAndAwait

        public Void writeEarlyHintsAndAwait​(MultiMap headers)
        Blocking variant of writeEarlyHints(io.vertx.mutiny.core.MultiMap).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        headers - headers to write
        Returns:
        the Void instance produced by the operation.
      • end

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> end​(String chunk)
        Same as end() but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        chunk -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        public Void endAndAwait​(String chunk)
        Blocking variant of end(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        chunk -
        Returns:
        the Void instance produced by the operation.
      • endAndForget

        public void endAndForget​(String chunk)
        Variant of end(String) that ignores the result of the operation.

        This method subscribes on the result of end(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from end(String) but you don't need to compose it with other operations.

        Parameters:
        chunk -
      • end

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> end​(String chunk,
                                                String enc)
        Same as end() but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        chunk -
        enc -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        public Void endAndAwait​(String chunk,
                                String enc)
        Blocking variant of end(String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        chunk -
        enc -
        Returns:
        the Void instance produced by the operation.
      • endAndForget

        public void endAndForget​(String chunk,
                                 String enc)
        Variant of end(String,String) that ignores the result of the operation.

        This method subscribes on the result of end(String,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from end(String,String) but you don't need to compose it with other operations.

        Parameters:
        chunk -
        enc -
      • end

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> end​(Buffer chunk)
        Same as end() but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Specified by:
        end in interface WriteStream<Buffer>
        Parameters:
        chunk -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • endAndAwait

        public Void endAndAwait​(Buffer chunk)
        Blocking variant of io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Specified by:
        endAndAwait in interface WriteStream<Buffer>
        Parameters:
        chunk -
        Returns:
        the Void instance produced by the operation.
      • endAndForget

        public void endAndForget​(Buffer chunk)
        Variant of io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.core.streams.WriteStream#end(io.vertx.mutiny.core.buffer.Buffer) but you don't need to compose it with other operations.

        Specified by:
        endAndForget in interface WriteStream<Buffer>
        Parameters:
        chunk -
      • send

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> send()
        Send the request with an empty body.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendAndAwait

        public Void sendAndAwait()
        Blocking variant of send().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • sendAndForget

        public void sendAndForget()
        Variant of send() that ignores the result of the operation.

        This method subscribes on the result of send(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from send() but you don't need to compose it with other operations.

      • send

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> send​(String body)
        Send the request with a string body.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        body -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendAndAwait

        public Void sendAndAwait​(String body)
        Blocking variant of send(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        body -
        Returns:
        the Void instance produced by the operation.
      • sendAndForget

        public void sendAndForget​(String body)
        Variant of send(String) that ignores the result of the operation.

        This method subscribes on the result of send(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from send(String) but you don't need to compose it with other operations.

        Parameters:
        body -
      • send

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> send​(Buffer body)
        Send the request with a buffer body.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        body -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendAndAwait

        public Void sendAndAwait​(Buffer body)
        Blocking variant of send(io.vertx.mutiny.core.buffer.Buffer).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        body -
        Returns:
        the Void instance produced by the operation.
      • send

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> send​(ReadStream<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.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        body -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendAndAwait

        public Void sendAndAwait​(ReadStream<Buffer> body)
        Blocking variant of send(io.vertx.mutiny.core.streams.ReadStream).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        body -
        Returns:
        the Void instance produced by the operation.
      • send

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> send​(Flow.Publisher<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.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        body -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendAndAwait

        public Void sendAndAwait​(Flow.Publisher<Buffer> body)
        Blocking variant of io.vertx.mutiny.core.http.HttpServerResponse#send(Flow$Publisher).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        body -
        Returns:
        the Void instance produced by the operation.
      • sendAndForget

        public void sendAndForget​(Flow.Publisher<Buffer> body)
        Variant of io.vertx.mutiny.core.http.HttpServerResponse#send(Flow$Publisher) that ignores the result of the operation.

        This method subscribes on the result of io.vertx.mutiny.core.http.HttpServerResponse#send(Flow$Publisher), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from io.vertx.mutiny.core.http.HttpServerResponse#send(Flow$Publisher) but you don't need to compose it with other operations.

        Parameters:
        body -
      • sendFile

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> sendFile​(String filename)
        Like sendFile(java.lang.String) but providing a handler which will be notified once the file has been completely written to the wire.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        filename - path to the file to serve
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendFileAndAwait

        public Void sendFileAndAwait​(String filename)
        Blocking variant of sendFile(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        filename - path to the file to serve
        Returns:
        the Void instance produced by the operation.
      • sendFileAndForget

        public HttpServerResponse sendFileAndForget​(String filename)
        Variant of sendFile(String) that ignores the result of the operation.

        This method subscribes on the result of sendFile(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from sendFile(String) but you don't need to compose it with other operations.

        Parameters:
        filename - path to the file to serve
        Returns:
        the instance of HttpServerResponse to chain method calls.
      • sendFile

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> sendFile​(String filename,
                                                     long offset)
        Like sendFile(java.lang.String) but providing a handler which will be notified once the file has been completely written to the wire.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        filename - path to the file to serve
        offset - the offset to serve from
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendFileAndAwait

        public Void sendFileAndAwait​(String filename,
                                     long offset)
        Blocking variant of sendFile(String,long).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        filename - path to the file to serve
        offset - the offset to serve from
        Returns:
        the Void instance produced by the operation.
      • sendFileAndForget

        public HttpServerResponse sendFileAndForget​(String filename,
                                                    long offset)
        Variant of sendFile(String,long) that ignores the result of the operation.

        This method subscribes on the result of sendFile(String,long), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from sendFile(String,long) but you don't need to compose it with other operations.

        Parameters:
        filename - path to the file to serve
        offset - the offset to serve from
        Returns:
        the instance of HttpServerResponse to chain method calls.
      • sendFile

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> sendFile​(String filename,
                                                     long offset,
                                                     long length)
        Like sendFile(java.lang.String) but providing a handler which will be notified once the file has been completely written to the wire.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        filename - path to the file to serve
        offset - the offset to serve from
        length - length the number of bytes to send
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sendFileAndAwait

        public Void sendFileAndAwait​(String filename,
                                     long offset,
                                     long length)
        Blocking variant of sendFile(String,long,long).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        filename - path to the file to serve
        offset - the offset to serve from
        length - length the number of bytes to send
        Returns:
        the Void instance produced by the operation.
      • sendFileAndForget

        public HttpServerResponse sendFileAndForget​(String filename,
                                                    long offset,
                                                    long length)
        Variant of sendFile(String,long,long) that ignores the result of the operation.

        This method subscribes on the result of sendFile(String,long,long), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from sendFile(String,long,long) but you don't need to compose it with other operations.

        Parameters:
        filename - path to the file to serve
        offset - the offset to serve from
        length - length the number of bytes to send
        Returns:
        the instance of HttpServerResponse to chain method calls.
      • 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​(Runnable handler)
        Parameters:
        handler - the handler
        Returns:
      • 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
      • pushAndAwait

        public HttpServerResponse pushAndAwait​(io.vertx.core.http.HttpMethod method,
                                               String host,
                                               String path)
        Blocking variant of push(HttpMethod,String,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        method -
        host -
        path -
        Returns:
        the HttpServerResponse instance produced by the operation.
      • push

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<HttpServerResponse> push​(io.vertx.core.http.HttpMethod method,
                                                               String path,
                                                               MultiMap headers)
        Like push(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String) with the host copied from the current request.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        method -
        path -
        headers -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • pushAndAwait

        public HttpServerResponse pushAndAwait​(io.vertx.core.http.HttpMethod method,
                                               String path,
                                               MultiMap headers)
        Blocking variant of push(HttpMethod,String,io.vertx.mutiny.core.MultiMap).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        method -
        path -
        headers -
        Returns:
        the HttpServerResponse instance produced by the operation.
      • push

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<HttpServerResponse> push​(io.vertx.core.http.HttpMethod method,
                                                               String path)
        Like push(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String) with the host copied from the current request.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        method -
        path -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • pushAndAwait

        public HttpServerResponse pushAndAwait​(io.vertx.core.http.HttpMethod method,
                                               String path)
        Blocking variant of push(HttpMethod,String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        method -
        path -
        Returns:
        the HttpServerResponse instance produced by the operation.
      • pushAndForget

        public HttpServerResponse pushAndForget​(io.vertx.core.http.HttpMethod method,
                                                String path)
        Variant of push(HttpMethod,String) that ignores the result of the operation.

        This method subscribes on the result of push(HttpMethod,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from push(HttpMethod,String) but you don't need to compose it with other operations.

        Parameters:
        method -
        path -
        Returns:
        the instance of HttpServerResponse to chain method calls.
      • push

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<HttpServerResponse> push​(io.vertx.core.http.HttpMethod method,
                                                               String host,
                                                               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.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        method - the method of the promised request
        host -
        path - the path of the promised request
        headers - the headers of the promised request
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • pushAndAwait

        public HttpServerResponse pushAndAwait​(io.vertx.core.http.HttpMethod method,
                                               String host,
                                               String path,
                                               MultiMap headers)
        Blocking variant of push(HttpMethod,String,String,io.vertx.mutiny.core.MultiMap).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        method - the method of the promised request
        host -
        path - the path of the promised request
        headers - the headers of the promised request
        Returns:
        the HttpServerResponse instance produced by the operation.
      • push

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<HttpServerResponse> push​(io.vertx.core.http.HttpMethod method,
                                                               HostAndPort authority,
                                                               String path,
                                                               MultiMap headers)
        Same as push(io.vertx.core.http.HttpMethod, java.lang.String, java.lang.String) but with an handler called when the operation completes

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        method -
        authority -
        path -
        headers -
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • reset

        public boolean reset()
        Returns:
      • reset

        public boolean reset​(long code)
        Parameters:
        code - the error code
        Returns:
        true when reset has been performed
      • writeCustomFrame

        public HttpServerResponse writeCustomFrame​(int type,
                                                   int flags,
                                                   Buffer payload)
        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 HttpServerResponse writeCustomFrame​(HttpFrame frame)
        Parameters:
        frame - the frame to write
        Returns:
        the instance of HttpServerResponse to chain method calls.
      • setStreamPriority

        public HttpServerResponse setStreamPriority​(io.vertx.core.http.StreamPriority streamPriority)
        Parameters:
        streamPriority - the priority for this request's stream
        Returns:
        the instance of HttpServerResponse to chain method calls.
      • addCookie

        public HttpServerResponse addCookie​(Cookie cookie)
        Parameters:
        cookie - the cookie
        Returns:
        a reference to this, so the API can be used fluently
      • removeCookie

        public Cookie removeCookie​(String name)
        Parameters:
        name - the name of the cookie
        Returns:
        the cookie, if it existed, or null
      • removeCookie

        public Cookie removeCookie​(String name,
                                   boolean invalidate)
        Parameters:
        name - the name of the cookie
        invalidate -
        Returns:
        the cookie, if it existed, or null
      • removeCookies

        public Set<Cookie> removeCookies​(String name)
        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)
        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)
        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)
        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
      • newInstance

        public static HttpServerResponse newInstance​(io.vertx.core.http.HttpServerResponse arg)