Top Description Methods
io.vertx.core.http

public Interface HttpClientResponse

extends ReadStream<Buffer>, HttpResponseHead
Known Direct Implementers
io.vertx.core.http.impl.HttpClientResponseImpl
Annotations
@VertxGen
Imports
com.fasterxml.jackson.annotation.JsonIgnoreProperties, io.vertx.codegen.annotations.*, io.vertx.core.AsyncResult, .Future, .Handler, .MultiMap, io.vertx.core.buffer.Buffer, io.vertx.core.net.NetSocket, io.vertx.core.streams.ReadStream, java.util.List

Represents a client-side HTTP response.

Vert.x provides you with one of these via the handler that was provided when creating the io.vertx.core.http.HttpClientRequest or that was set on the io.vertx.core.http.HttpClientRequest instance.

It implements io.vertx.core.streams.ReadStream so it can be used with io.vertx.core.streams.Pipe to pipe data with flow control.

Author
Tim Fox

Method Summary

Modifier and TypeMethod and Description
public default HttpClientResponse
body(Handler<AsyncResult<Buffer>> handler)

Same as body() but with an handler called when the operation completes

public Future<Buffer>

Returns:

a future completed with the body result
body
()

Convenience method for receiving the entire request body in one piece.

public default HttpClientResponse
bodyHandler(Handler<Buffer>
This handler will be called after all the body has been received
bodyHandler
)

Convenience method for receiving the entire request body in one piece.

public HttpClientResponse

Returns:

a reference to this, so the API can be used fluently
customFrameHandler
(Handler<HttpFrame> handler)

Set an custom frame handler.

public default void
end(Handler<AsyncResult<Void>> handler)

Same as end() but with an handler called when the operation completes

public Future<Void>

Returns:

a future completed with the body result
end
()

Returns a future signaling when the response has been fully received successfully or failed.

public HttpClientResponse
endHandler(Handler<Void> endHandler)

public HttpClientResponse
public HttpClientResponse
fetch(long amount)

Redeclares io.vertx.core.streams.ReadStream.fetch.

Fetch the specified amount of elements.

public @Nullable String

Returns:

the trailer value
getTrailer
(String
the trailer name
trailerName
)

Return the first trailer value with the specified name

public HttpClientResponse
public NetSocket

Returns:

a NetSocket facade to interact with the HTTP client response.
netSocket
()

public HttpClientResponse
pause()

Redeclares io.vertx.core.streams.ReadStream.pause.

Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

public HttpClientRequest

Returns:

the corresponding request
request
()

public HttpClientResponse
resume()

Redeclares io.vertx.core.streams.ReadStream.resume.

Resume reading, and sets the buffer in flowing mode.

public HttpClientResponse
streamPriorityHandler(Handler<StreamPriority>
the handler to be called when the stream priority changes
handler
)

Set an handler for stream priority changes.

public MultiMap

Returns:

the trailers
trailers
()

Inherited from io.vertx.core.http.HttpResponseHead:
cookiesgetHeadergetHeaderheadersstatusCodestatusMessageversion
Inherited from io.vertx.core.streams.ReadStream:
collectendHandlerexceptionHandlerhandlerpipepipeTopipeTo

Method Detail

bodyback to summary
public default HttpClientResponse body(Handler<AsyncResult<Buffer>> handler)

Same as body() but with an handler called when the operation completes

Annotations
@Fluent
bodyback to summary
public Future<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.

Returns:Future<Buffer>

a future completed with the body result

bodyHandlerback to summary
public default HttpClientResponse bodyHandler(Handler<Buffer> 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:Handler<Buffer>

This handler will be called after all the body has been received

Annotations
@Fluent
customFrameHandlerback to summary
public HttpClientResponse customFrameHandler(Handler<HttpFrame> handler)

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:HttpClientResponse

a reference to this, so the API can be used fluently

Annotations
@Fluent
endback to summary
public default void end(Handler<AsyncResult<Void>> handler)

Same as end() but with an handler called when the operation completes

endback to summary
public Future<Void> end()

Returns a future signaling when the response has been fully received successfully or failed.

Returns:Future<Void>

a future completed with the body result

endHandlerback to summary
public HttpClientResponse endHandler(Handler<Void> endHandler)
Annotations
@Override
exceptionHandlerback to summary
public HttpClientResponse exceptionHandler(Handler<Throwable> handler)
Annotations
@Override
fetchback to summary
public HttpClientResponse fetch(long amount)

Redeclares io.vertx.core.streams.ReadStream.fetch.

Doc from io.vertx.core.streams.ReadStream.fetch.

Fetch the specified amount of elements. If the ReadStream has been paused, reading will recommence with the specified amount of items, otherwise the specified amount will be added to the current stream demand.

Returns:HttpClientResponse

a reference to this, so the API can be used fluently

Annotations
@Override
getTrailerback to summary
public @Nullable String getTrailer(String trailerName)

Return the first trailer value with the specified name

Parameters
trailerName:String

the trailer name

Returns:@Nullable String

the trailer value

handlerback to summary
public HttpClientResponse handler(Handler<Buffer> handler)
Annotations
@Override
netSocketback to summary
public NetSocket netSocket()
Returns:NetSocket

a NetSocket facade to interact with the HTTP client response.

Annotations
@CacheReturn
pauseback to summary
public HttpClientResponse pause()

Redeclares io.vertx.core.streams.ReadStream.pause.

Doc from io.vertx.core.streams.ReadStream.pause.

Pause the ReadStream, it sets the buffer in fetch mode and clears the actual demand.

While it's paused, no data will be sent to the data handler.

Returns:HttpClientResponse

a reference to this, so the API can be used fluently

Annotations
@Override
requestback to summary
public HttpClientRequest request()
Returns:HttpClientRequest

the corresponding request

Annotations
@CacheReturn
resumeback to summary
public HttpClientResponse resume()

Redeclares io.vertx.core.streams.ReadStream.resume.

Doc from io.vertx.core.streams.ReadStream.resume.

Resume reading, and sets the buffer in flowing mode.

If the ReadStream has been paused, reading will recommence on it.

Returns:HttpClientResponse

a reference to this, so the API can be used fluently

Annotations
@Override
streamPriorityHandlerback to summary
public HttpClientResponse streamPriorityHandler(Handler<StreamPriority> handler)

Set an handler for stream priority changes.

This is not implemented for HTTP/1.x.

Parameters
handler:Handler<StreamPriority>

the handler to be called when the stream priority changes

Annotations
@Fluent
trailersback to summary
public MultiMap trailers()
Returns:MultiMap

the trailers

Annotations
@CacheReturn