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() 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() 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 io. so it can be used with
io. to pipe data with flow control.
An example of using this class is as follows:
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlyoverride the request authority authority)Override the request authority, when using HTTP/1.x this overrides the request |
| public void | connect(Handler<AsyncResult<HttpClientResponse>>
the response completion handler handler)Create an HTTP tunnel to the server. |
| public Future | |
| public HttpConnection | |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlyIf you send an HTTP request with the header |
| public HttpClientRequest | |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlyIf the server responds with an interim HTTP response with a status code of |
| public Future | Returns: a future completed with the resultthe data chunk chunk)Redeclares as abstract: io. Same as |
| public void | end(String chunk, Handler<AsyncResult<Void>> handler)
Redeclares as abstract: io. Same as |
| public Future | Returns: a future completed with the resultthe data chunk chunk, String the encoding enc)Same as |
| public void | end(String chunk, String enc, Handler<AsyncResult<Void>> handler)
Same as |
| public Future | Returns: a future completed with the resultthe data to write chunk)Redeclares as abstract: io.
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Same as |
| public void | end(Buffer chunk, Handler<AsyncResult<Void>> handler)
Redeclares as abstract: io.
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Same as |
| public Future | Returns: a future completed with the resultRedeclares as abstract: io. Ends the request. |
| public void | end(Handler<AsyncResult<Void>> handler)
Redeclares io. Redeclares as abstract: io. Same as |
| public HttpClientRequest | |
| public String | Returns: the host value of the HTTP/1.1host header or HTTP/2 authority pseudo header
Deprecated
|
| public int | |
| public HttpMethod | |
| public int | Returns: the port value of the HTTP/1.1host header or HTTP/2 authority pseudo header
Deprecated
|
| public StreamPriority | |
| public String | |
| public MultiMap | |
| public default HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe amount of time in milliseconds. 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 |
| public boolean | |
| public boolean | |
| public int | |
| public String | |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe handler handler)Set a push handler for this request. |
| public HttpClientRequest | |
| public HttpClientRequest | putHeader(CharSequence name, CharSequence value)
Like |
| public HttpClientRequest | |
| public HttpClientRequest | putHeader(CharSequence name, Iterable<CharSequence> values)
Like |
| public String | |
| public HttpClientRequest | |
| public default boolean | |
| public boolean | Returns: true when reset has been performedthe error code code)Reset this request:
|
| public boolean | Returns: true when reset has been performedthe error code code, Throwable an optional cause that can be attached to the error code cause)Reset this request:
|
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe completion handler handler)Set a callback for the associated |
| public Future | |
| public default void | send(Handler<AsyncResult<HttpClientResponse>>
the completion handler for the handler)HttpClientResponseSend the request with an empty body. |
| public default Future | |
| public default void | send(String body, Handler<AsyncResult<HttpClientResponse>>
the completion handler for the handler)HttpClientResponseSend the request with a string |
| public default Future | |
| public default void | send(Buffer body, Handler<AsyncResult<HttpClientResponse>>
the completion handler for the handler)HttpClientResponse
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Send the request with a buffer |
| public default Future | send(Buffer body)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Like |
| public default void | send(ReadStream<Buffer> body, Handler<AsyncResult<HttpClientResponse>>
the completion handler for the handler)HttpClientResponseSend the request with a stream |
| public default Future | send(ReadStream<Buffer> body)
Like |
| public Future | |
| public HttpClientRequest | sendHead(Handler<AsyncResult<Void>> completionHandler)
Like |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlytrue if chunked encoding chunked)If chunked is true then the request will be set into HTTP chunked mode |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlytrue to follow HTTP redirectsSet the request to follow HTTP redirects up to |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe host part of the HTTP/1.1 host)host header or HTTP/2 authority pseudo header
Deprecated
instead use
authority(HostAndPort)
Set the host value of the HTTP/1.1 The initial value is the same as the server socket address host. |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe number of HTTP redirect to follow maxRedirects)Set the max number of HTTP redirects this request will follow. |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe HTTP method method)Set the HTTP method for this request. |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe port part of the HTTP/1.1 port)host header or HTTP/2 authority pseudo header
Deprecated
instead use
authority(HostAndPort)
Set the port value of the HTTP/1.1 Keep in mind that this won't change the actual server socket address for this request. |
| public default HttpClientRequest | setStreamPriority(StreamPriority
the priority of this request's stream streamPriority)Sets the priority of the associated stream. |
| public HttpClientRequest | setTimeout(long timeout)
Deprecated
instead use
idleTimeout(long)
Like |
| public HttpClientRequest | |
| public HttpClientRequest | setWriteQueueMaxSize(int
the max size of the write stream maxSize)Redeclares io. Set the maximum size of the write queue to |
| public default int | Returns: the id of the stream of this response, -1 when it is not yet determined, i.e the request has not been yet sent or it is not supported HTTP/1.x
|
| public HttpClientRequest | Returns: @return a reference to this, so the API can be used fluentlythe operation op)Set the trace operation of this request. |
| public String | |
| public HttpVersion | |
| public Future | Returns: a future completed with the resultthe data chunk chunk)Redeclares io. Write a |
| public void | write(String chunk, Handler<AsyncResult<Void>> handler)
Redeclares io. Same as |
| public Future | |
| public void | write(String chunk, String enc, Handler<AsyncResult<Void>> handler)
Same as |
| public HttpClientRequest | Returns: a reference to this, so the API can be used fluentlythe 8-bit frame type type, int the 8-bit frame flags flags, Buffer the frame payload payload)
References Deprecated
Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
Write an HTTP/2 frame to the request, allowing to extend the HTTP/2 protocol. |
| public default HttpClientRequest | writeCustomFrame(HttpFrame
the frame to write frame)Like |