public class HttpClientRequest extends Object implements WriteStream<Buffer>
Instances are created by an HttpClient
instance, via one of the methods corresponding to the
specific HTTP methods, or the generic request methods. On creation the request will not have been written to the
wire.
Once a request has been obtained, headers can be set on it, and data can be written to its body if required. Once
you are ready to send the request, one of the end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
methods should be called.
Nothing is actually sent until the request has been internally assigned an HTTP connection.
The HttpClient
instance will return an instance of this class immediately, even if there are no HTTP
connections available in the pool. Any requests sent before a connection is assigned will be queued
internally and actually sent when an HTTP connection becomes available from the pool.
The headers of the request are queued for writing either when the end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
method is called, or, when the first
part of the body is written, whichever occurs first.
This class supports both chunked and non-chunked HTTP.
It implements WriteStream
so it can be used with
Pipe
to pipe data with flow control.
An example of using this class is as follows:
NOTE: This class has been automatically generated from the
original
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<HttpClientRequest> |
__TYPE_ARG |
Constructor and Description |
---|
HttpClientRequest(HttpClientRequest delegate) |
HttpClientRequest(Object delegate) |
Modifier and Type | Method and Description |
---|---|
String |
absoluteURI() |
HttpClientRequest |
authority(HostAndPort authority)
Override the request authority, when using HTTP/1.x this overrides the request
host header, when using
HTTP/2 this sets the authority pseudo header. |
void |
connect()
Create an HTTP tunnel to the server.
|
void |
connect(Handler<AsyncResult<HttpClientResponse>> handler)
Create an HTTP tunnel to the server.
|
HttpConnection |
connection() |
HttpClientRequest |
continueHandler(Handler<Void> handler)
If you send an HTTP request with the header
Expect set to the value 100-continue
and the server responds with an interim HTTP response with a status code of 100 and a Continue handler
has been set using this method, then the handler will be called. |
HttpClientRequest |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
HttpClientRequest |
earlyHintsHandler(Handler<MultiMap> handler)
If the server responds with an interim HTTP response with a status code of
103 and a Early Hints handler
has been set using this method, then the handler will be called. |
void |
end()
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(Buffer chunk)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(Buffer chunk,
Handler<AsyncResult<Void>> handler)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(Handler<AsyncResult<Void>> handler)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(String chunk)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(String chunk,
Handler<AsyncResult<Void>> handler)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(String chunk,
String enc)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(String chunk,
String enc,
Handler<AsyncResult<Void>> handler)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
boolean |
equals(Object o) |
HttpClientRequest |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
HttpClientRequest |
getDelegate() |
String |
getHost()
Deprecated.
|
int |
getMaxRedirects() |
HttpMethod |
getMethod()
The HTTP method for the request.
|
int |
getPort()
Deprecated.
|
StreamPriority |
getStreamPriority() |
String |
getURI() |
int |
hashCode() |
MultiMap |
headers() |
HttpClientRequest |
idleTimeout(long timeout)
Sets the amount of time after which, if the request does not return any data within the timeout period,
the request/response is closed and the related futures are failed with a
TimeoutException ,
e.g. |
boolean |
isChunked() |
boolean |
isFollowRedirects() |
static HttpClientRequest |
newInstance(HttpClientRequest arg) |
int |
numberOfRedirections() |
String |
path() |
HttpClientRequest |
pushHandler(Handler<HttpClientRequest> handler)
Set a push handler for this request.
The handler is called when the client receives a push promise from the server.
|
HttpClientRequest |
putHeader(CharSequence name,
CharSequence value)
Like
putHeader(java.lang.String, java.lang.String) but using CharSequence |
HttpClientRequest |
putHeader(CharSequence name,
Iterable<CharSequence> values)
Like
putHeader(java.lang.String, java.lang.String) but using CharSequence |
HttpClientRequest |
putHeader(String name,
Iterable<String> values)
Put an HTTP header with multiple values
|
HttpClientRequest |
putHeader(String name,
String value)
Put an HTTP header
|
String |
query() |
HttpClientRequest |
redirectHandler(java.util.function.Function<HttpClientResponse,Future<HttpClientRequest>> handler) |
HttpClientRequest |
redirectHandler(Function<HttpClientResponse,Single<HttpClientRequest>> handler) |
boolean |
reset()
Reset this stream with the error code
0 . |
boolean |
reset(long code)
Reset this request:
for HTTP/2, this performs send an HTTP/2 reset frame with the specified error
code
for HTTP/1.x, this closes the connection when the current request is inflight
When the request has not yet been sent, the request will be aborted and false is returned as indicator. |
boolean |
reset(long code,
Throwable cause)
Reset this request:
for HTTP/2, send an HTTP/2 reset frame with the specified error
code
for HTTP/1.x, close the connection when the current request is inflight
When the request has not yet been sent, the request will be aborted and false is returned as indicator. |
HttpClientRequest |
response()
Set a callback for the associated
HttpClientResponse . |
HttpClientRequest |
response(Handler<AsyncResult<HttpClientResponse>> handler)
Set a callback for the associated
HttpClientResponse . |
Single<HttpClientResponse> |
rxConnect()
Create an HTTP tunnel to the server.
|
Completable |
rxEnd()
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxEnd(Buffer chunk)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxEnd(String chunk)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxEnd(String chunk,
String enc)
Same as
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Single<HttpClientResponse> |
rxResponse()
Set a callback for the associated
HttpClientResponse . |
Single<HttpClientResponse> |
rxSend()
Send the request with an empty body.
|
Single<HttpClientResponse> |
rxSend(Buffer body)
Send the request with a buffer
body . |
Single<HttpClientResponse> |
rxSend(Flowable<Buffer> body)
Send the request with a stream
body . |
Single<HttpClientResponse> |
rxSend(ReadStream<Buffer> body)
Send the request with a stream
body . |
Single<HttpClientResponse> |
rxSend(String body)
Send the request with a string
body . |
Completable |
rxSendHead()
Like
sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler after headers have been sent. |
Completable |
rxWrite(Buffer data)
Same as but with an
handler called when the operation completes |
Completable |
rxWrite(String chunk)
Same as
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxWrite(String chunk,
String enc)
Same as
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
send()
Send the request with an empty body.
|
void |
send(Buffer body)
Send the request with a buffer
body . |
void |
send(Buffer body,
Handler<AsyncResult<HttpClientResponse>> handler)
Send the request with a buffer
body . |
void |
send(Flowable<Buffer> body)
Send the request with a stream
body . |
void |
send(Flowable<Buffer> body,
Handler<AsyncResult<HttpClientResponse>> handler)
Send the request with a stream
body . |
void |
send(Handler<AsyncResult<HttpClientResponse>> handler)
Send the request with an empty body.
|
void |
send(ReadStream<Buffer> body)
Send the request with a stream
body . |
void |
send(ReadStream<Buffer> body,
Handler<AsyncResult<HttpClientResponse>> handler)
Send the request with a stream
body . |
void |
send(String body)
Send the request with a string
body . |
void |
send(String body,
Handler<AsyncResult<HttpClientResponse>> handler)
Send the request with a string
body . |
HttpClientRequest |
sendHead()
Like
sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler after headers have been sent. |
HttpClientRequest |
sendHead(Handler<AsyncResult<Void>> completionHandler)
Like
sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler after headers have been sent. |
HttpClientRequest |
setChunked(boolean chunked)
If chunked is true then the request will be set into HTTP chunked mode
|
HttpClientRequest |
setFollowRedirects(boolean followRedirects)
Set the request to follow HTTP redirects up to
HttpClientOptions . |
HttpClientRequest |
setHost(String host)
Deprecated.
|
HttpClientRequest |
setMaxRedirects(int maxRedirects)
Set the max number of HTTP redirects this request will follow.
|
HttpClientRequest |
setMethod(HttpMethod method)
Set the HTTP method for this request.
|
HttpClientRequest |
setPort(int port)
Deprecated.
|
HttpClientRequest |
setStreamPriority(StreamPriority streamPriority)
Sets the priority of the associated stream.
|
HttpClientRequest |
setTimeout(long timeout)
Deprecated.
|
HttpClientRequest |
setURI(String uri)
Set the request uri.
|
HttpClientRequest |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize . |
int |
streamId() |
WriteStreamObserver<Buffer> |
toObserver() |
String |
toString() |
WriteStreamSubscriber<Buffer> |
toSubscriber() |
String |
traceOperation() |
HttpClientRequest |
traceOperation(String op)
Set the trace operation of this request.
|
HttpVersion |
version() |
void |
write(Buffer data)
Same as but with an
handler called when the operation completes |
void |
write(Buffer data,
Handler<AsyncResult<Void>> handler)
Same as but with an
handler called when the operation completes |
void |
write(String chunk)
Same as
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
write(String chunk,
Handler<AsyncResult<Void>> handler)
Same as
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
write(String chunk,
String enc)
Same as
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
write(String chunk,
String enc,
Handler<AsyncResult<Void>> handler)
Same as
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
HttpClientRequest |
writeCustomFrame(HttpFrame frame)
Like
writeCustomFrame(int, int, io.vertx.reactivex.core.buffer.Buffer) but with an HttpFrame . |
HttpClientRequest |
writeCustomFrame(int type,
int flags,
Buffer payload)
Write an HTTP/2 frame to the request, allowing to extend the HTTP/2 protocol.
|
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
newInstance, newInstance
newInstance
public static final io.vertx.lang.rx.TypeArg<HttpClientRequest> __TYPE_ARG
public HttpClientRequest(HttpClientRequest delegate)
public HttpClientRequest(Object delegate)
public HttpClientRequest getDelegate()
getDelegate
in interface StreamBase
getDelegate
in interface WriteStream<Buffer>
public WriteStreamObserver<Buffer> toObserver()
toObserver
in interface WriteStream<Buffer>
public WriteStreamSubscriber<Buffer> toSubscriber()
toSubscriber
in interface WriteStream<Buffer>
public void write(Buffer data, Handler<AsyncResult<Void>> handler)
handler
called when the operation completeswrite
in interface WriteStream<Buffer>
data
- handler
- public void write(Buffer data)
handler
called when the operation completeswrite
in interface WriteStream<Buffer>
data
- public Completable rxWrite(Buffer data)
handler
called when the operation completesrxWrite
in interface WriteStream<Buffer>
data
- public boolean writeQueueFull()
true
if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int)
writeQueueFull
in interface WriteStream<Buffer>
true
if write queue is fullpublic HttpClientRequest exceptionHandler(Handler<Throwable> handler)
WriteStream
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<Buffer>
handler
- the exception handlerpublic HttpClientRequest setWriteQueueMaxSize(int maxSize)
WriteStream
maxSize
. You will still be able to write to the stream even
if there is more than maxSize
items in the write queue. This is used as an indicator by classes such as
Pipe
to provide flow control.
The value is defined by the implementation of the stream, e.g in bytes for a
NetSocket
, etc...setWriteQueueMaxSize
in interface WriteStream<Buffer>
maxSize
- the max size of the write streampublic HttpClientRequest drainHandler(Handler<Void> handler)
WriteStream
Pipe
for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to maxSize / 2
.
drainHandler
in interface WriteStream<Buffer>
handler
- the handlerpublic HttpClientRequest authority(HostAndPort authority)
host
header, when using
HTTP/2 this sets the authority
pseudo header. When the port is a negative value, the default
scheme port will be used.
The default request authority is the server host and port when connecting to the server.
authority
- override the request authority@Deprecated public HttpClientRequest setHost(String host)
host
header or HTTP/2 authority
pseudo header
The initial value is the same as the server socket address host.
Keep in mind that changing this value won't change the actual server socket address for this request.
host
- the host part of the HTTP/1.1 host
header or HTTP/2 authority
pseudo header@Deprecated public String getHost()
host
header or HTTP/2 authority
pseudo header@Deprecated public HttpClientRequest setPort(int port)
host
header or HTTP/2 authority
pseudo header
Keep in mind that this won't change the actual server socket address for this request.
The initial value is the same than the server socket address port.
port
- the port part of the HTTP/1.1 host
header or HTTP/2 authority
pseudo header@Deprecated public int getPort()
host
header or HTTP/2 authority
pseudo headerpublic HttpClientRequest setFollowRedirects(boolean followRedirects)
HttpClientOptions
.followRedirects
- true
to follow HTTP redirectspublic boolean isFollowRedirects()
public HttpClientRequest setMaxRedirects(int maxRedirects)
0
which means
no redirects.maxRedirects
- the number of HTTP redirect to followpublic int getMaxRedirects()
public int numberOfRedirections()
public HttpClientRequest setChunked(boolean chunked)
chunked
- true if chunked encodingpublic boolean isChunked()
public HttpMethod getMethod()
public HttpClientRequest setMethod(HttpMethod method)
method
- the HTTP methodpublic String absoluteURI()
public String getURI()
public HttpClientRequest setURI(String uri)
uri
- the request uripublic String path()
public String query()
public MultiMap headers()
public HttpClientRequest putHeader(String name, String value)
name
- The header namevalue
- The header valuepublic HttpClientRequest traceOperation(String op)
op
- the operationpublic String traceOperation()
public HttpVersion version()
public void write(String chunk, Handler<AsyncResult<Void>> handler)
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- handler
- public void write(String chunk)
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- public Completable rxWrite(String chunk)
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- public void write(String chunk, String enc, Handler<AsyncResult<Void>> handler)
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- enc
- handler
- public void write(String chunk, String enc)
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- enc
- public Completable rxWrite(String chunk, String enc)
write(io.vertx.reactivex.core.buffer.Buffer, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- enc
- public HttpClientRequest continueHandler(Handler<Void> handler)
Expect
set to the value 100-continue
and the server responds with an interim HTTP response with a status code of 100
and a Continue handler
has been set using this method, then the handler
will be called.
You can then continue to write data to the request body and later end it. This is normally used in conjunction with
the sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
method to force the request header to be written before the request has ended.
handler
- public HttpClientRequest earlyHintsHandler(Handler<MultiMap> handler)
103
and a Early Hints handler
has been set using this method, then the handler
will be called.handler
- public HttpClientRequest redirectHandler(java.util.function.Function<HttpClientResponse,Future<HttpClientRequest>> handler)
public HttpClientRequest redirectHandler(Function<HttpClientResponse,Single<HttpClientRequest>> handler)
public HttpClientRequest sendHead(Handler<AsyncResult<Void>> completionHandler)
sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler after headers have been sent. The handler will be called with
the HttpVersion
if it can be determined or null otherwise.completionHandler
- public HttpClientRequest sendHead()
sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler after headers have been sent. The handler will be called with
the HttpVersion
if it can be determined or null otherwise.public Completable rxSendHead()
sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler after headers have been sent. The handler will be called with
the HttpVersion
if it can be determined or null otherwise.public void connect(Handler<AsyncResult<HttpClientResponse>> handler)
Send HTTP request headers to the server, then configures the transport to exchange raw buffers when the server replies with an appropriate response:
200
for HTTP CONNECT
method101
for HTTP/1.1 GET
with Upgrade
connection
header The handler
is called after response headers are received.
Use HttpClientResponse.netSocket()
to get a for interacting
more conveniently with the server.
HTTP/1.1 pipe-lined requests are not supported.f
handler
- the response completion handlerpublic void connect()
Send HTTP request headers to the server, then configures the transport to exchange raw buffers when the server replies with an appropriate response:
200
for HTTP CONNECT
method101
for HTTP/1.1 GET
with Upgrade
connection
header The handler
is called after response headers are received.
Use HttpClientResponse.netSocket()
to get a for interacting
more conveniently with the server.
HTTP/1.1 pipe-lined requests are not supported.f
public Single<HttpClientResponse> rxConnect()
Send HTTP request headers to the server, then configures the transport to exchange raw buffers when the server replies with an appropriate response:
200
for HTTP CONNECT
method101
for HTTP/1.1 GET
with Upgrade
connection
header The handler
is called after response headers are received.
Use HttpClientResponse.netSocket()
to get a for interacting
more conveniently with the server.
HTTP/1.1 pipe-lined requests are not supported.f
public HttpClientRequest response(Handler<AsyncResult<HttpClientResponse>> handler)
HttpClientResponse
.
This method does not modify the current request being sent.
handler
- the completion handlerpublic HttpClientRequest response()
HttpClientResponse
.
This method does not modify the current request being sent.
public Single<HttpClientResponse> rxResponse()
HttpClientResponse
.
This method does not modify the current request being sent.
public void send(Handler<AsyncResult<HttpClientResponse>> handler)
handler
- the completion handler for the HttpClientResponse
public void send()
public Single<HttpClientResponse> rxSend()
public void send(String body, Handler<AsyncResult<HttpClientResponse>> handler)
body
.body
- handler
- the completion handler for the HttpClientResponse
public void send(String body)
body
.body
- public Single<HttpClientResponse> rxSend(String body)
body
.body
- public void send(Buffer body, Handler<AsyncResult<HttpClientResponse>> handler)
body
.body
- handler
- the completion handler for the HttpClientResponse
public void send(Buffer body)
body
.body
- public Single<HttpClientResponse> rxSend(Buffer body)
body
.body
- public void send(ReadStream<Buffer> body, Handler<AsyncResult<HttpClientResponse>> handler)
body
.
If the HttpHeaders
is set then the request assumes this is the
length of the {stream}, otherwise the request will set a chunked HttpHeaders
.
body
- handler
- the completion handler for the HttpClientResponse
public void send(ReadStream<Buffer> body)
body
.
If the HttpHeaders
is set then the request assumes this is the
length of the {stream}, otherwise the request will set a chunked HttpHeaders
.
body
- public Single<HttpClientResponse> rxSend(ReadStream<Buffer> body)
body
.
If the HttpHeaders
is set then the request assumes this is the
length of the {stream}, otherwise the request will set a chunked HttpHeaders
.
body
- public void send(Flowable<Buffer> body, Handler<AsyncResult<HttpClientResponse>> handler)
body
.
If the HttpHeaders
is set then the request assumes this is the
length of the {stream}, otherwise the request will set a chunked HttpHeaders
.
body
- handler
- the completion handler for the HttpClientResponse
public void send(Flowable<Buffer> body)
body
.
If the HttpHeaders
is set then the request assumes this is the
length of the {stream}, otherwise the request will set a chunked HttpHeaders
.
body
- public Single<HttpClientResponse> rxSend(Flowable<Buffer> body)
body
.
If the HttpHeaders
is set then the request assumes this is the
length of the {stream}, otherwise the request will set a chunked HttpHeaders
.
body
- public void end(String chunk, Handler<AsyncResult<Void>> handler)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- handler
- public void end(String chunk)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- public Completable rxEnd(String chunk)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- public void end(String chunk, String enc, Handler<AsyncResult<Void>> handler)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- enc
- handler
- public void end(String chunk, String enc)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- enc
- public Completable rxEnd(String chunk, String enc)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completeschunk
- enc
- public void end(Buffer chunk, Handler<AsyncResult<Void>> handler)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completesend
in interface WriteStream<Buffer>
chunk
- handler
- public void end(Buffer chunk)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completesend
in interface WriteStream<Buffer>
chunk
- public Completable rxEnd(Buffer chunk)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completesrxEnd
in interface WriteStream<Buffer>
chunk
- public void end(Handler<AsyncResult<Void>> handler)
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completesend
in interface WriteStream<Buffer>
handler
- public void end()
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completesend
in interface WriteStream<Buffer>
public Completable rxEnd()
end(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
but with an handler
called when the operation completesrxEnd
in interface WriteStream<Buffer>
@Deprecated public HttpClientRequest setTimeout(long timeout)
idleTimeout(long)
but with a confusing name (hence the deprecation).timeout
- public HttpClientRequest idleTimeout(long timeout)
TimeoutException
,
e.g. Future
or Future
response body.timeout
- the amount of time in milliseconds.public HttpClientRequest pushHandler(Handler<HttpClientRequest> handler)
HttpClientRequest
, the following methods can be called:
In addition the handler should call the response(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.http.HttpClientResponse>>)
method to set an handler to
process the response.handler
- the handlerpublic boolean reset()
0
.public boolean reset(long code)
code
code
- the error codetrue
when reset has been performedpublic boolean reset(long code, Throwable cause)
code
false
is returned as indicator.
code
- the error codecause
- an optional cause that can be attached to the error codepublic HttpConnection connection()
HttpConnection
associated with this requestpublic HttpClientRequest writeCustomFrame(int type, int flags, Buffer payload)
The frame is sent immediatly and is not subject to flow control.
This method must be called after the request headers have been sent and only for the protocol HTTP/2.
The sendHead(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
should be used for this purpose.
type
- the 8-bit frame typeflags
- the 8-bit frame flagspayload
- the frame payloadpublic int streamId()
public HttpClientRequest writeCustomFrame(HttpFrame frame)
writeCustomFrame(int, int, io.vertx.reactivex.core.buffer.Buffer)
but with an HttpFrame
.frame
- the frame to writepublic HttpClientRequest setStreamPriority(StreamPriority streamPriority)
streamPriority
- the priority of this request's streampublic StreamPriority getStreamPriority()
null
public HttpClientRequest putHeader(CharSequence name, CharSequence value)
putHeader(java.lang.String, java.lang.String)
but using CharSequencename
- value
- public HttpClientRequest putHeader(String name, Iterable<String> values)
name
- The header namevalues
- The header valuespublic HttpClientRequest putHeader(CharSequence name, Iterable<CharSequence> values)
putHeader(java.lang.String, java.lang.String)
but using CharSequencename
- values
- public static HttpClientRequest newInstance(HttpClientRequest arg)
Copyright © 2024 Eclipse. All rights reserved.