Top Description Fields Constructors Methods
io.vertx.core.http.impl

public Class HttpClientResponseImpl

extends Object
implements HttpClientResponse
Class Inheritance
All Implemented Interfaces
io.vertx.core.http.HttpClientResponse, io.vertx.core.http.HttpResponseHead, io.vertx.core.streams.ReadStream, io.vertx.core.streams.StreamBase
Imports
io.netty.handler.codec.http.DefaultHttpHeaders, io.vertx.core.Future, .Handler, .MultiMap, io.vertx.core.buffer.Buffer, io.vertx.core.http.*, io.vertx.core.http.impl.headers.HeadersAdaptor, io.vertx.core.impl.logging.Logger, .LoggerFactory, io.vertx.core.net.NetSocket, io.vertx.core.net.impl.ConnectionBase, java.util.ArrayList, .List

This class is optimised for performance when used on the same event loop that is was passed to the handler with. However it can be used safely from other threads. The internal state is protected using the synchronized keyword. If always used on the same event loop, then we benefit from biased locking which makes the overhead of synchronized near zero.
Author
Tim Fox

Field Summary

Modifier and TypeField and Description
private final HttpConnection
private List<String>
private Handler<HttpFrame>
private HttpEventHandler
private MultiMap
private static final Logger
private NetSocket
private Handler<StreamPriority>
private final HttpClientRequestBase
private final int
private final String
private final HttpClientStream
private MultiMap
private final HttpVersion

Constructor Summary

AccessConstructor and Description
pack-priv
HttpClientResponseImpl(HttpClientRequestBase request, HttpVersion version, HttpClientStream stream, int statusCode, String statusMessage, MultiMap headers)

Method Summary

Modifier and TypeMethod and Description
public Future<Buffer>
body()

Implements io.vertx.core.http.HttpClientResponse.body.

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

private void
public List<String>
public HttpClientResponse
public synchronized Future<Void>
end()

Implements io.vertx.core.http.HttpClientResponse.end.

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

public HttpClientResponse
private HttpEventHandler
eventHandler(boolean create)

public HttpClientResponse
public HttpClientResponse
fetch(long amount)

Implements io.vertx.core.http.HttpClientResponse.fetch.

Fetch the specified amount of elements.

public String
getHeader(String
the header name
headerName
)

Implements io.vertx.core.http.HttpResponseHead.getHeader.

Return the first header value with the specified name

public String
getHeader(CharSequence
the header name
headerName
)

Implements io.vertx.core.http.HttpResponseHead.getHeader.

Return the first header value with the specified name

public String
getTrailer(String
the trailer name
trailerName
)

Implements io.vertx.core.http.HttpClientResponse.getTrailer.

Return the first trailer value with the specified name

pack-priv void
handleChunk(Buffer data)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

pack-priv void
handleEnd(MultiMap trailers)

pack-priv void
pack-priv void
public HttpClientResponse
pack-priv void
public MultiMap
public NetSocket
public HttpClientResponse
pause()

Implements io.vertx.core.http.HttpClientResponse.pause.

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

public HttpClientRequestBase
public HttpClientResponse
resume()

Implements io.vertx.core.http.HttpClientResponse.resume.

Resume reading, and sets the buffer in flowing mode.

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

Implements io.vertx.core.http.HttpClientResponse.streamPriorityHandler.

Set an handler for stream priority changes.

public MultiMap
public HttpVersion
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connback to summary
private final HttpConnection conn
cookiesback to summary
private List<String> cookies
customFrameHandlerback to summary
private Handler<HttpFrame> customFrameHandler
eventHandlerback to summary
private HttpEventHandler eventHandler
headersback to summary
private MultiMap headers
logback to summary
private static final Logger log
netSocketback to summary
private NetSocket netSocket
priorityHandlerback to summary
private Handler<StreamPriority> priorityHandler
requestback to summary
private final HttpClientRequestBase request
statusCodeback to summary
private final int statusCode
statusMessageback to summary
private final String statusMessage
streamback to summary
private final HttpClientStream stream
trailersback to summary
private MultiMap trailers
versionback to summary
private final HttpVersion version

Constructor Detail

HttpClientResponseImplback to summary
pack-priv HttpClientResponseImpl(HttpClientRequestBase request, HttpVersion version, HttpClientStream stream, int statusCode, String statusMessage, MultiMap headers)

Method Detail

bodyback to summary
public Future<Buffer> body()

Implements io.vertx.core.http.HttpClientResponse.body.

Doc from io.vertx.core.http.HttpClientResponse.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

Annotations
@Override
checkEndedback to summary
private void checkEnded()
cookiesback to summary
public List<String> cookies()

Implements io.vertx.core.http.HttpResponseHead.cookies.

Returns:List<String>

Doc from io.vertx.core.http.HttpResponseHead.cookies.

the Set-Cookie headers (including trailers)

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

Implements io.vertx.core.http.HttpClientResponse.customFrameHandler.

Doc from io.vertx.core.http.HttpClientResponse.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:HttpClientResponse

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

Annotations
@Override
endback to summary
public synchronized Future<Void> end()

Implements io.vertx.core.http.HttpClientResponse.end.

Doc from io.vertx.core.http.HttpClientResponse.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

Annotations
@Override
endHandlerback to summary
public HttpClientResponse endHandler(Handler<Void> handler)

Implements io.vertx.core.http.HttpClientResponse.endHandler.

Annotations
@Override
eventHandlerback to summary
private HttpEventHandler eventHandler(boolean create)
exceptionHandlerback to summary
public HttpClientResponse exceptionHandler(Handler<Throwable> handler)

Implements io.vertx.core.http.HttpClientResponse.exceptionHandler.

Annotations
@Override
fetchback to summary
public HttpClientResponse fetch(long amount)

Implements io.vertx.core.http.HttpClientResponse.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
getHeaderback to summary
public String getHeader(String headerName)

Implements io.vertx.core.http.HttpResponseHead.getHeader.

Doc from io.vertx.core.http.HttpResponseHead.getHeader.

Return the first header value with the specified name

Parameters
headerName:String

the header name

Returns:String

the header value

Annotations
@Override
getHeaderback to summary
public String getHeader(CharSequence headerName)

Implements io.vertx.core.http.HttpResponseHead.getHeader.

Doc from io.vertx.core.http.HttpResponseHead.getHeader.

Return the first header value with the specified name

Parameters
headerName:CharSequence

the header name

Returns:String

the header value

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

Implements io.vertx.core.http.HttpClientResponse.getTrailer.

Doc from io.vertx.core.http.HttpClientResponse.getTrailer.

Return the first trailer value with the specified name

Parameters
trailerName:String

the trailer name

Returns:String

the trailer value

Annotations
@Override
handleChunkback to summary
pack-priv void handleChunk(Buffer data)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

handleEndback to summary
pack-priv void handleEnd(MultiMap trailers)
handleExceptionback to summary
pack-priv void handleException(Throwable e)
handlePriorityChangeback to summary
pack-priv void handlePriorityChange(StreamPriority streamPriority)
handlerback to summary
public HttpClientResponse handler(Handler<Buffer> handler)

Implements io.vertx.core.http.HttpClientResponse.handler.

Annotations
@Override
handleUnknownFrameback to summary
pack-priv void handleUnknownFrame(HttpFrame frame)
headersback to summary
public MultiMap headers()

Implements io.vertx.core.http.HttpResponseHead.headers.

Returns:MultiMap

Doc from io.vertx.core.http.HttpResponseHead.headers.

the headers

Annotations
@Override
netSocketback to summary
public NetSocket netSocket()

Implements io.vertx.core.http.HttpClientResponse.netSocket.

Returns:NetSocket

Doc from io.vertx.core.http.HttpClientResponse.netSocket.

a NetSocket facade to interact with the HTTP client response.

Annotations
@Override
pauseback to summary
public HttpClientResponse pause()

Implements io.vertx.core.http.HttpClientResponse.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 HttpClientRequestBase request()

Implements io.vertx.core.http.HttpClientResponse.request.

Returns:HttpClientRequestBase

Doc from io.vertx.core.http.HttpClientResponse.request.

the corresponding request

Annotations
@Override
resumeback to summary
public HttpClientResponse resume()

Implements io.vertx.core.http.HttpClientResponse.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
statusCodeback to summary
public int statusCode()

Implements io.vertx.core.http.HttpResponseHead.statusCode.

Returns:int

Doc from io.vertx.core.http.HttpResponseHead.statusCode.

the status code of the response

Annotations
@Override
statusMessageback to summary
public String statusMessage()

Implements io.vertx.core.http.HttpResponseHead.statusMessage.

Returns:String

Doc from io.vertx.core.http.HttpResponseHead.statusMessage.

the status message of the response

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

Implements io.vertx.core.http.HttpClientResponse.streamPriorityHandler.

Doc from io.vertx.core.http.HttpClientResponse.streamPriorityHandler.

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
@Override
trailersback to summary
public MultiMap trailers()

Implements io.vertx.core.http.HttpClientResponse.trailers.

Returns:MultiMap

Doc from io.vertx.core.http.HttpClientResponse.trailers.

the trailers

Annotations
@Override
versionback to summary
public HttpVersion version()

Implements io.vertx.core.http.HttpResponseHead.version.

Returns:HttpVersion

Doc from io.vertx.core.http.HttpResponseHead.version.

the version of the response

Annotations
@Override