Class HttpClientResponse
- All Implemented Interfaces:
MutinyDelegate,HttpResponseHead,ReadStream<io.vertx.core.buffer.Buffer>,StreamBase
Vert.x provides you with one of these via the handler that was provided when creating the HttpClientRequest
or that was set on the HttpClientRequest instance.
It implements ReadStream 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.
- Author:
- Tim Fox
- See Also:
-
HttpClientResponse
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vertx.mutiny.core.http.HttpResponseHead
HttpResponseHead.HttpResponseHeadImplNested classes/interfaces inherited from interface io.vertx.mutiny.core.streams.ReadStream
ReadStream.ReadStreamImpl<T>Nested classes/interfaces inherited from interface io.vertx.mutiny.core.streams.StreamBase
StreamBase.StreamBaseImpl -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpClientResponse(io.vertx.core.http.HttpClientResponse delegate) Create a new instance ofHttpClientResponsedelegating to the given (non-null) instance ofHttpClientResponse.HttpClientResponse(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<io.vertx.core.buffer.Buffer>body()Convenience method for receiving the entire request body in one piece.io.vertx.core.buffer.BufferConvenience method for receiving the entire request body in one piece.Convenience method for receiving the entire request body in one piece.bodyHandler(Consumer<io.vertx.core.buffer.Buffer> bodyHandler) Convenience method for receiving the entire request body in one piece.cookies()customFrameHandler(Consumer<io.vertx.core.http.HttpFrame> handler) Set an custom frame handler.io.smallrye.mutiny.Uni<Void>end()Returns a uni signaling when the response has been fully received successfully or failed.voidReturns a underlying uni signaling when the response has been fully received successfully or failed.Returns a underlying uni signaling when the response has been fully received successfully or failed.endHandler(Runnable endHandler) Set an end handler.booleanexceptionHandler(Consumer<Throwable> handler) Set an exception handler on the read stream.fetch(long amount) Fetch the specifiedamountof elements.io.vertx.core.http.HttpClientResponseGet the delegate instance.getHeader(CharSequence arg0) Return the first header value with the specified nameReturn the first header value with the specified namegetTrailer(String trailerName) Return the first trailer value with the specified nameSet a data handler.inthashCode()io.vertx.core.MultiMapheaders()static HttpClientResponsenewInstance(io.vertx.core.http.HttpClientResponse delegate) Creates a new instance of theHttpClientResponse.pause()Pause theReadStream, it sets the buffer infetchmode and clears the actual demand.Pipe<io.vertx.core.buffer.Buffer>pipe()Pause this stream and return aPipeto transfer the elements of this stream to a destinationWriteStream.io.smallrye.mutiny.Uni<Void>pipeTo(WriteStream<io.vertx.core.buffer.Buffer> arg0) Pipe thisReadStreamto theWriteStream.voidpipeToAndAwait(WriteStream<io.vertx.core.buffer.Buffer> arg0) Pipe thisReadStreamto theWriteStream.pipeToAndForget(WriteStream<io.vertx.core.buffer.Buffer> arg0) Pipe thisReadStreamto theWriteStream.request()resume()Resume reading, and sets the buffer inflowingmode.intstreamPriorityHandler(Consumer<io.vertx.core.http.StreamPriority> handler) Set an handler for stream priority changes.Iterable<io.vertx.core.buffer.Buffer>Stream<io.vertx.core.buffer.Buffer>io.smallrye.mutiny.Multi<io.vertx.core.buffer.Buffer>toMulti()toString()io.vertx.core.MultiMaptrailers()io.vertx.core.http.HttpVersionversion()
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
HttpClientResponse
public HttpClientResponse(io.vertx.core.http.HttpClientResponse delegate) Create a new instance ofHttpClientResponsedelegating to the given (non-null) instance ofHttpClientResponse. -
HttpClientResponse
-
-
Method Details
-
getDelegate
public io.vertx.core.http.HttpClientResponse getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceHttpResponseHead- Specified by:
getDelegatein interfaceMutinyDelegate- Specified by:
getDelegatein interfaceReadStream<io.vertx.core.buffer.Buffer>- Specified by:
getDelegatein interfaceStreamBase- Returns:
- the delegate instance
-
body
@CheckReturnValue public io.smallrye.mutiny.Uni<io.vertx.core.buffer.Buffer> body()Convenience method for receiving the entire request body in one piece.This saves you having to manually set a dataHandler and an endHandler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpClientResponse.body()
-
bodyAndAwait
public io.vertx.core.buffer.Buffer bodyAndAwait()Convenience method for receiving the entire request body in one piece.This saves you having to manually set a dataHandler and an endHandler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.
Unlike the bare Vert.x variant, this method returns a
Buffer. This method awaits indefinitely 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 aRuntimeException).- Returns:
- The operation result
- See Also:
-
HttpClientResponse.body()
-
bodyAndForget
Convenience method for receiving the entire request body in one piece.This saves you having to manually set a dataHandler and an endHandler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.
Unlike the bare Vert.x variant, this method ignores the
Bufferresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpClientResponse.body()
-
end
Returns a uni signaling when the response has been fully received successfully or failed.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
HttpClientResponse.end()
-
endAndAwait
public void endAndAwait()Returns a underlying uni signaling when the response has been fully received successfully or failed.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
HttpClientResponse.end()
-
endAndForget
Returns a underlying uni signaling when the response has been fully received successfully or failed.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
HttpClientResponse.end()
-
pipeTo
@CheckReturnValue public io.smallrye.mutiny.Uni<Void> pipeTo(WriteStream<io.vertx.core.buffer.Buffer> arg0) Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Specified by:
pipeToin interfaceReadStream<io.vertx.core.buffer.Buffer>- Parameters:
dst- the destination write stream- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
io.vertx.core.http.HttpClientResponse#pipeTo(WriteStream)
-
pipeToAndAwait
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Parameters:
dst- the destination write stream- See Also:
-
io.vertx.core.http.HttpClientResponse#pipeTo(WriteStream)
-
pipeToAndForget
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
dst- the destination write stream- Returns:
- The current instance to chain operations if needed.
- See Also:
-
io.vertx.core.http.HttpClientResponse#pipeTo(WriteStream)
-
fetch
Description copied from interface:ReadStreamFetch the specifiedamountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand.- Specified by:
fetchin interfaceReadStream<io.vertx.core.buffer.Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
resume
Description copied from interface:ReadStreamResume reading, and sets the buffer inflowingmode. If theReadStreamhas been paused, reading will recommence on it.- Specified by:
resumein interfaceReadStream<io.vertx.core.buffer.Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
exceptionHandler
Description copied from interface:ReadStreamSet an exception handler on the read stream.- Specified by:
exceptionHandlerin interfaceReadStream<io.vertx.core.buffer.Buffer>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler. Can benull.- Returns:
- a reference to this, so the API can be used fluently
-
handler
Description copied from interface:ReadStreamSet a data handler. As data is read, the handler will be called with the data.- Specified by:
handlerin interfaceReadStream<io.vertx.core.buffer.Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
pause
Description copied from interface:ReadStreamPause theReadStream, it sets the buffer infetchmode and clears the actual demand.While it's paused, no data will be sent to the data
handler.- Specified by:
pausein interfaceReadStream<io.vertx.core.buffer.Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
Description copied from interface:ReadStreamSet an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.- Specified by:
endHandlerin interfaceReadStream<io.vertx.core.buffer.Buffer>- Returns:
- a reference to this, so the API can be used fluently
-
netSocket
- Returns:
- a
NetSocketfacade to interact with the HTTP client response.
-
getTrailer
Return the first trailer value with the specified name- Parameters:
trailerName- the trailer name- Returns:
- the trailer value. Can be
null.
-
trailers
public io.vertx.core.MultiMap trailers()- Returns:
- the trailers
-
bodyHandler
Convenience method for receiving the entire request body in one piece.This saves you having to manually set a dataHandler and an endHandler and append the chunks of the body until the whole body received. Don't use this if your request body is large - you could potentially run out of RAM.
- Parameters:
bodyHandler- This handler will be called after all the body has been received
-
customFrameHandler
Set an custom frame handler. The handler will get notified when the http stream receives an custom HTTP/2 frame. HTTP/2 permits extension of the protocol.- Returns:
- a reference to this, so the API can be used fluently
-
request
- Returns:
- the corresponding request
-
streamPriorityHandler
public HttpClientResponse streamPriorityHandler(Consumer<io.vertx.core.http.StreamPriority> handler) Set an handler for stream priority changes. This is not implemented for HTTP/1.x.- Parameters:
handler- the handler to be called when the stream priority changes
-
getHeader
Return the first header value with the specified name- Specified by:
getHeaderin interfaceHttpResponseHead- Parameters:
headerName- the header name- Returns:
- the header value. Can be
null.
-
statusMessage
- Specified by:
statusMessagein interfaceHttpResponseHead- Returns:
- the status message of the response
-
version
public io.vertx.core.http.HttpVersion version()- Specified by:
versionin interfaceHttpResponseHead- Returns:
- the version of the response
-
statusCode
public int statusCode()- Specified by:
statusCodein interfaceHttpResponseHead- Returns:
- the status code of the response
-
pipe
Pause this stream and return aPipeto transfer the elements of this stream to a destinationWriteStream. The stream will be resumed when the pipe will be wired to aWriteStream.- Specified by:
pipein interfaceReadStream<io.vertx.core.buffer.Buffer>- Returns:
- a pipe
-
headers
public io.vertx.core.MultiMap headers()- Specified by:
headersin interfaceHttpResponseHead- Returns:
- the headers
-
cookies
- Specified by:
cookiesin interfaceHttpResponseHead- Returns:
- the Set-Cookie headers (including trailers)
-
getHeader
Return the first header value with the specified name- Specified by:
getHeaderin interfaceHttpResponseHead- Parameters:
headerName- the header name- Returns:
- the header value. Can be
null.
-
newInstance
Creates a new instance of theHttpClientResponse. -
hashCode
public int hashCode() -
equals
-
toString
-
toMulti
@CheckReturnValue public io.smallrye.mutiny.Multi<io.vertx.core.buffer.Buffer> toMulti() -
toBlockingIterable
-
toBlockingStream
-