Class HttpClientResponse
- java.lang.Object
-
- io.vertx.mutiny.core.http.HttpClientResponse
-
- All Implemented Interfaces:
HttpResponseHead
,ReadStream<Buffer>
,StreamBase
public class HttpClientResponse extends Object implements ReadStream<Buffer>, HttpResponseHead
Represents a client-side HTTP response.Vert.x provides you with one of these via the handler that was provided when creating the
HttpClientRequest
or that was set on theHttpClientRequest
instance.It implements
NOTE: This class has been automatically generated from theReadStream
so it can be used withPipe
to pipe data with flow control.original
non Mutiny-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<HttpClientResponse>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description HttpClientResponse(io.vertx.core.http.HttpClientResponse delegate)
HttpClientResponse(Object delegate)
-
Method Summary
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<HttpClientResponse> __TYPE_ARG
-
-
Constructor Detail
-
HttpClientResponse
public HttpClientResponse(io.vertx.core.http.HttpClientResponse delegate)
-
HttpClientResponse
public HttpClientResponse(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.http.HttpClientResponse getDelegate()
- Specified by:
getDelegate
in interfaceHttpResponseHead
- Specified by:
getDelegate
in interfaceReadStream<Buffer>
- Specified by:
getDelegate
in interfaceStreamBase
-
version
public io.vertx.core.http.HttpVersion version()
- Specified by:
version
in interfaceHttpResponseHead
- Returns:
- the version of the response
-
statusCode
public int statusCode()
- Specified by:
statusCode
in interfaceHttpResponseHead
- Returns:
- the status code of the response
-
statusMessage
public String statusMessage()
- Specified by:
statusMessage
in interfaceHttpResponseHead
- Returns:
- the status message of the response
-
headers
public MultiMap headers()
- Specified by:
headers
in interfaceHttpResponseHead
- Returns:
- the headers
-
getHeader
public String getHeader(String headerName)
- Specified by:
getHeader
in interfaceHttpResponseHead
- Parameters:
headerName
- the header name- Returns:
- the header value
-
cookies
public List<String> cookies()
- Specified by:
cookies
in interfaceHttpResponseHead
- Returns:
- the Set-Cookie headers (including trailers)
-
pipe
public Pipe<Buffer> pipe()
- Specified by:
pipe
in interfaceReadStream<Buffer>
- Returns:
- a pipe
-
pipeTo
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<Buffer> dst)
Pipe thisReadStream
to theWriteStream
.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handler
will be called with the result.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Specified by:
pipeTo
in interfaceReadStream<Buffer>
- Parameters:
dst
- the destination write stream- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
pipeToAndAwait
public Void pipeToAndAwait(WriteStream<Buffer> dst)
Blocking variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
.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:
pipeToAndAwait
in interfaceReadStream<Buffer>
- Parameters:
dst
- the destination write stream- Returns:
- the Void instance produced by the operation.
-
pipeToAndForget
public void pipeToAndForget(WriteStream<Buffer> dst)
Variant ofReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
that ignores the result of the operation.This method subscribes on the result of
ReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromReadStream.pipeTo(io.vertx.mutiny.core.streams.WriteStream)
but you don't need to compose it with other operations.- Specified by:
pipeToAndForget
in interfaceReadStream<Buffer>
- Parameters:
dst
- the destination write stream
-
fetch
public HttpClientResponse fetch(long amount)
- Specified by:
fetch
in interfaceReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
-
resume
public HttpClientResponse resume()
- Specified by:
resume
in interfaceReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
public HttpClientResponse exceptionHandler(Consumer<Throwable> handler)
- Specified by:
exceptionHandler
in interfaceReadStream<Buffer>
- Specified by:
exceptionHandler
in interfaceStreamBase
- Parameters:
handler
- the exception handler- Returns:
-
handler
public HttpClientResponse handler(Consumer<Buffer> handler)
- Specified by:
handler
in interfaceReadStream<Buffer>
- Returns:
-
pause
public HttpClientResponse pause()
- Specified by:
pause
in interfaceReadStream<Buffer>
- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public HttpClientResponse endHandler(Runnable endHandler)
- Specified by:
endHandler
in interfaceReadStream<Buffer>
- Returns:
-
netSocket
public NetSocket netSocket()
- Returns:
- a
NetSocket
facade to interact with the HTTP client response.
-
getTrailer
public String getTrailer(String trailerName)
- Parameters:
trailerName
- the trailer name- Returns:
- the trailer value
-
trailers
public MultiMap trailers()
- Returns:
- the trailers
-
bodyHandler
public HttpClientResponse bodyHandler(Consumer<Buffer> bodyHandler)
- Parameters:
bodyHandler
- This handler will be called after all the body has been received- Returns:
-
body
@CheckReturnValue public io.smallrye.mutiny.Uni<Buffer> body()
Same asbody()
but with anhandler
called when the operation completesUnlike 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.
-
bodyAndAwait
public Buffer bodyAndAwait()
Blocking variant ofbody()
.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 Buffer instance produced by the operation.
-
bodyAndForget
public HttpClientResponse bodyAndForget()
Variant ofbody()
that ignores the result of the operation.This method subscribes on the result of
body()
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation frombody()
but you don't need to compose it with other operations.- Returns:
- the instance of HttpClientResponse to chain method calls.
-
end
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> end()
Same asend()
but with anhandler
called when the operation completesUnlike 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.
-
endAndAwait
public Void endAndAwait()
Blocking variant ofend()
.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.
-
endAndForget
public void endAndForget()
-
customFrameHandler
public HttpClientResponse customFrameHandler(Consumer<HttpFrame> handler)
- Parameters:
handler
-- Returns:
-
request
public HttpClientRequest request()
- Returns:
- the corresponding request
-
streamPriorityHandler
public HttpClientResponse streamPriorityHandler(Consumer<io.vertx.core.http.StreamPriority> handler)
- Parameters:
handler
- the handler to be called when the stream priority changes- Returns:
-
getHeader
public String getHeader(CharSequence headerName)
- Specified by:
getHeader
in interfaceHttpResponseHead
- Parameters:
headerName
- the header name- Returns:
- the header value
-
toMulti
@CheckReturnValue public io.smallrye.mutiny.Multi<Buffer> toMulti()
- Specified by:
toMulti
in interfaceReadStream<Buffer>
-
newInstance
public static HttpClientResponse newInstance(io.vertx.core.http.HttpClientResponse arg)
-
-