@groovy.transform.CompileStatic class HttpClientResponse extends java.lang.Object
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 the HttpClientRequest instance.
It implements ReadStream so it can be used with Pump to pump data with flow control.
Constructor and description |
---|
HttpClientResponse
(java.lang.Object delegate) |
Type | Name and description |
---|---|
HttpClientResponse |
bodyHandler(io.vertx.core.Handler<Buffer> bodyHandler) Convenience method for receiving the entire request body in one piece. |
java.util.List<java.lang.String> |
cookies() @return
|
HttpClientResponse |
customFrameHandler(io.vertx.core.Handler<HttpFrame> handler) Set an custom frame handler. |
HttpClientResponse |
endHandler(io.vertx.core.Handler<java.lang.Void> endHandler) |
HttpClientResponse |
exceptionHandler(io.vertx.core.Handler<java.lang.Throwable> handler) |
java.lang.Object |
getDelegate() |
java.lang.String |
getHeader(java.lang.String headerName) Return the first header value with the specified name |
java.lang.String |
getTrailer(java.lang.String trailerName) Return the first trailer value with the specified name |
HttpClientResponse |
handler(io.vertx.core.Handler<Buffer> handler) |
MultiMap |
headers() @return
|
NetSocket |
netSocket() Get a net socket for the underlying connection of this request. |
HttpClientResponse |
pause() |
HttpClientResponse |
resume() |
int |
statusCode() @return
|
java.lang.String |
statusMessage() @return
|
MultiMap |
trailers() @return
|
io.vertx.core.http.HttpVersion |
version() @return
|
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
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.
bodyHandler
- This handler will be called after all the body has been received
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.
Return the first header value with the specified name
headerName
- the header nameReturn the first trailer value with the specified name
trailerName
- the trailer name
Get a net socket for the underlying connection of this request.
USE THIS WITH CAUTION! Writing to the socket directly if you don't know what you're doing can easily break the HTTP protocol
One valid use-case for calling this is to receive the NetSocket after a HTTP CONNECT was issued to the remote peer and it responded with a status code of 200.