Class HttpRequest<T>
- java.lang.Object
-
- io.vertx.reactivex.ext.web.client.HttpRequest<T>
-
public class HttpRequest<T> extends Object
A client-side HTTP request.Instances are created by an
WebClientinstance, via one of the methods corresponding to the specific HTTP methods such asWebClient.get(java.lang.String), etc...The request shall be configured prior sending, the request is immutable and when a mutator method is called, a new request is returned allowing to expose the request in a public API and apply further customization.
After the request has been configured, the methods
send(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)sendStream(io.vertx.reactivex.core.streams.ReadStream<io.vertx.reactivex.core.buffer.Buffer>, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)sendJson(java.lang.Object, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)()}sendForm(io.vertx.reactivex.core.MultiMap, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)
sendXXXmethods perform the actual request, they can be called multiple times to perform the same HTTP request at different points in time.The handler is called back with
- an
HttpResponseinstance when the HTTP response has been received - a failure when the HTTP request failed (like a connection error) or when the HTTP response could not be obtained (like connection or unmarshalling errors)
Most of the time, this client will buffer the HTTP response fully unless a specific is used such as .
NOTE: This class has been automatically generated from theoriginalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<HttpRequest>__TYPE_ARGTypeArg<T>__typeArg_0
-
Constructor Summary
Constructors Constructor Description HttpRequest(HttpRequest delegate)HttpRequest(Object delegate, TypeArg<T> typeArg_0)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpRequest<T>addQueryParam(String paramName, String paramValue)Add a query parameter to the request.<U> HttpRequest<U>as(BodyCodec<U> responseCodec)Configure the request to decode the response with theresponseCodec.HttpRequest<T>authentication(Credentials credentials)Configure the request to perform HTTP Authentication.HttpRequest<T>basicAuthentication(Buffer id, Buffer password)Configure the request to perform basic access authentication.HttpRequest<T>basicAuthentication(String id, String password)Configure the request to perform basic access authentication.HttpRequest<T>bearerTokenAuthentication(String bearerToken)Configure the request to perform bearer token authentication.BodyCodec<T>bodyCodec()HttpRequest<T>copy()Copy this requestbooleanequals(Object o)HttpRequest<T>expect(ResponsePredicate predicate)Add an expectation that the response is valid according to the providedpredicate.HttpRequest<T>expect(Function<HttpResponse<Void>,ResponsePredicateResult> predicate)Add an expectation that the response is valid according to the providedpredicate.List<ResponsePredicate>expectations()booleanfollowRedirects()HttpRequest<T>followRedirects(boolean value)Set whether to follow request redirectionsHttpRequestgetDelegate()inthashCode()MultiMapheaders()Stringhost()HttpRequest<T>host(String value)Configure the request to use a new hostvalue.HttpMethodmethod()HttpRequest<T>method(HttpMethod value)Configure the request to use a new methodvalue.booleanmultipartMixed()HttpRequest<T>multipartMixed(boolean allow)Allow or disallow multipart mixed encoding when sending having files sharing the same file name.static <T> HttpRequest<T>newInstance(HttpRequest arg)static <T> HttpRequest<T>newInstance(HttpRequest arg, TypeArg<T> __typeArg_T)intport()HttpRequest<T>port(int value)Configure the request to use a new portvalue.ProxyOptionsproxy()HttpRequest<T>proxy(ProxyOptions proxyOptions)Configure the request to set a proxy for this request.HttpRequest<T>putHeader(String name, Iterable<String> value)Configure the request to set a new HTTP header with multiple values.HttpRequest<T>putHeader(String name, String value)Configure the request to set a new HTTP header.HttpRequest<T>putHeaders(MultiMap headers)Configure the request to add multiple HTTP headers .MultiMapqueryParams()Return the current query parameters.io.reactivex.Single<HttpResponse<T>>rxSend()Send a request, thehandlerwill receive the response as anHttpResponse.io.reactivex.Single<HttpResponse<T>>rxSendBuffer(Buffer body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodybuffer.io.reactivex.Single<HttpResponse<T>>rxSendForm(MultiMap body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.io.reactivex.Single<HttpResponse<T>>rxSendForm(MultiMap body, String charset)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.io.reactivex.Single<HttpResponse<T>>rxSendJson(Object body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.io.reactivex.Single<HttpResponse<T>>rxSendJsonObject(JsonObject body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.io.reactivex.Single<HttpResponse<T>>rxSendMultipartForm(MultipartForm body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set tomultipart/form-data.io.reactivex.Single<HttpResponse<T>>rxSendStream(io.reactivex.Flowable<Buffer> body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.io.reactivex.Single<HttpResponse<T>>rxSendStream(ReadStream<Buffer> body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.voidsend()Send a request, thehandlerwill receive the response as anHttpResponse.voidsend(Handler<AsyncResult<HttpResponse<T>>> handler)Send a request, thehandlerwill receive the response as anHttpResponse.voidsendBuffer(Buffer body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodybuffer.voidsendBuffer(Buffer body, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodybuffer.voidsendForm(MultiMap body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.voidsendForm(MultiMap body, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.voidsendForm(MultiMap body, String charset)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.voidsendForm(MultiMap body, String charset, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.voidsendJson(Object body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.voidsendJson(Object body, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.voidsendJsonObject(JsonObject body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.voidsendJsonObject(JsonObject body, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.voidsendMultipartForm(MultipartForm body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set tomultipart/form-data.voidsendMultipartForm(MultipartForm body, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set tomultipart/form-data.voidsendStream(io.reactivex.Flowable<Buffer> body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.voidsendStream(io.reactivex.Flowable<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.voidsendStream(ReadStream<Buffer> body)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.voidsendStream(ReadStream<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.HttpRequest<T>setQueryParam(String paramName, String paramValue)Set a query parameter to the request.HttpRequest<T>setTemplateParam(String paramName, String paramValue)Set a request URI template string parameter to the request, expanded when the request URI is a .HttpRequest<T>setTemplateParam(String paramName, List<String> paramValue)Set a request URI template list parameter to the request, expanded when the request URI is a .HttpRequest<T>setTemplateParam(String paramName, Map<String,String> paramValue)Set a request URI template map parameter to the request, expanded when the request URI is a .Booleanssl()HttpRequest<T>ssl(Boolean value)Configure the request whether to use SSL.VariablestemplateParams()Return the current request URI template parameters.longtimeout()HttpRequest<T>timeout(long value)Configures the amount of time in milliseconds after which if the request does not return any data within the timeout period anTimeoutExceptionfails the request.StringtoString()StringtraceOperation()HttpRequest<T>traceOperation(String traceOperation)Trace operation name override.Stringuri()HttpRequest<T>uri(String value)Configure the request to use a new request URIvalue.StringvirtualHost()HttpRequest<T>virtualHost(String value)Configure the request to use a virtual hostvalue.
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<HttpRequest> __TYPE_ARG
-
-
Constructor Detail
-
HttpRequest
public HttpRequest(HttpRequest delegate)
-
-
Method Detail
-
getDelegate
public HttpRequest getDelegate()
-
method
public HttpRequest<T> method(HttpMethod value)
Configure the request to use a new methodvalue.- Parameters:
value-- Returns:
- a reference to this, so the API can be used fluently
-
method
public HttpMethod method()
- Returns:
- the request method
-
port
public HttpRequest<T> port(int value)
Configure the request to use a new portvalue.This overrides the port set by absolute URI requests
- Parameters:
value-- Returns:
- a reference to this, so the API can be used fluently
-
port
public int port()
- Returns:
- the request port or
0when none is set for absolute URI templates
-
as
public <U> HttpRequest<U> as(BodyCodec<U> responseCodec)
Configure the request to decode the response with theresponseCodec.- Parameters:
responseCodec- the response codec- Returns:
- a reference to this, so the API can be used fluently
-
host
public HttpRequest<T> host(String value)
Configure the request to use a new hostvalue.This overrides the host set by absolute URI requests
- Parameters:
value-- Returns:
- a reference to this, so the API can be used fluently
-
host
public String host()
- Returns:
- the request host or
nullwhen none is set for absolute URI templates
-
virtualHost
public HttpRequest<T> virtualHost(String value)
Configure the request to use a virtual hostvalue. Usually the header host (:authority pseudo header for HTTP/2) is set from the request host value since this host value resolves to the server IP address. Sometimes you need to set a host header for an address that does not resolve to the server IP address. The virtual host value overrides the value of the actual host header (:authority pseudo header for HTTP/2). The virtual host is also be used for SNI.- Parameters:
value-- Returns:
- a reference to this, so the API can be used fluently
-
virtualHost
public String virtualHost()
- Returns:
- the request virtual host if any or
null
-
uri
public HttpRequest<T> uri(String value)
Configure the request to use a new request URIvalue.This overrides the port set by absolute URI requests
When the uri has query parameters, they are set in the
queryParams(), overwriting any parameters previously set- Parameters:
value-- Returns:
- a reference to this, so the API can be used fluently
-
uri
public String uri()
- Returns:
- the request uri or
nullwhen none is set for absolute URI templates
-
putHeaders
public HttpRequest<T> putHeaders(MultiMap headers)
Configure the request to add multiple HTTP headers .- Parameters:
headers- The HTTP headers- Returns:
- a reference to this, so the API can be used fluently
-
putHeader
public HttpRequest<T> putHeader(String name, String value)
Configure the request to set a new HTTP header.- Parameters:
name- the header namevalue- the header value- Returns:
- a reference to this, so the API can be used fluently
-
headers
public MultiMap headers()
- Returns:
- The HTTP headers
-
basicAuthentication
public HttpRequest<T> basicAuthentication(String id, String password)
Configure the request to perform basic access authentication.In basic HTTP authentication, a request contains a header field of the form 'Authorization: Basic <credentials>', where credentials is the base64 encoding of id and password joined by a colon.
In practical terms the arguments are converted to a object.- Parameters:
id- the idpassword- the password- Returns:
- a reference to this, so the API can be used fluently
-
basicAuthentication
public HttpRequest<T> basicAuthentication(Buffer id, Buffer password)
Configure the request to perform basic access authentication.In basic HTTP authentication, a request contains a header field of the form 'Authorization: Basic <credentials>', where credentials is the base64 encoding of id and password joined by a colon.
In practical terms the arguments are converted to a object.- Parameters:
id- the idpassword- the password- Returns:
- a reference to this, so the API can be used fluently
-
bearerTokenAuthentication
public HttpRequest<T> bearerTokenAuthentication(String bearerToken)
Configure the request to perform bearer token authentication.In OAuth 2.0, a request contains a header field of the form 'Authorization: Bearer <bearerToken>', where bearerToken is the bearer token issued by an authorization server to access protected resources.
In practical terms the arguments are converted to a object.- Parameters:
bearerToken- the bearer token- Returns:
- a reference to this, so the API can be used fluently
-
ssl
public HttpRequest<T> ssl(Boolean value)
Configure the request whether to use SSL.This overrides the SSL value set by absolute URI requests
- Parameters:
value-- Returns:
- a reference to this, so the API can be used fluently
-
ssl
public Boolean ssl()
- Returns:
- whether the request uses SSL or
nullwhen none is set for absolute URI templates
-
timeout
public HttpRequest<T> timeout(long value)
Configures the amount of time in milliseconds after which if the request does not return any data within the timeout period anTimeoutExceptionfails the request.Setting zero or a negative
valuedisables the timeout.- Parameters:
value- The quantity of time in milliseconds.- Returns:
- a reference to this, so the API can be used fluently
-
timeout
public long timeout()
- Returns:
- the current timeout in milliseconds
-
addQueryParam
public HttpRequest<T> addQueryParam(String paramName, String paramValue)
Add a query parameter to the request.- Parameters:
paramName- the param nameparamValue- the param value- Returns:
- a reference to this, so the API can be used fluently
-
setQueryParam
public HttpRequest<T> setQueryParam(String paramName, String paramValue)
Set a query parameter to the request.- Parameters:
paramName- the param nameparamValue- the param value- Returns:
- a reference to this, so the API can be used fluently
-
setTemplateParam
public HttpRequest<T> setTemplateParam(String paramName, String paramValue)
Set a request URI template string parameter to the request, expanded when the request URI is a .- Parameters:
paramName- the param nameparamValue- the param value- Returns:
- a reference to this, so the API can be used fluently
-
setTemplateParam
public HttpRequest<T> setTemplateParam(String paramName, List<String> paramValue)
Set a request URI template list parameter to the request, expanded when the request URI is a .- Parameters:
paramName- the param nameparamValue- the param value- Returns:
- a reference to this, so the API can be used fluently
-
setTemplateParam
public HttpRequest<T> setTemplateParam(String paramName, Map<String,String> paramValue)
Set a request URI template map parameter to the request, expanded when the request URI is a .- Parameters:
paramName- the param nameparamValue- the param value- Returns:
- a reference to this, so the API can be used fluently
-
followRedirects
public HttpRequest<T> followRedirects(boolean value)
Set whether to follow request redirections- Parameters:
value- true if redirections should be followed- Returns:
- a reference to this, so the API can be used fluently
-
followRedirects
public boolean followRedirects()
- Returns:
- whether to follow request redirections
-
proxy
public HttpRequest<T> proxy(ProxyOptions proxyOptions)
Configure the request to set a proxy for this request. Setting proxy here supersedes the proxy set on the client itself- Parameters:
proxyOptions- The proxy options- Returns:
- a reference to this, so the API can be used fluently
-
proxy
public ProxyOptions proxy()
- Returns:
- the proxy for this request
-
expect
public HttpRequest<T> expect(Function<HttpResponse<Void>,ResponsePredicateResult> predicate)
Add an expectation that the response is valid according to the providedpredicate.Multiple predicates can be added.
- Parameters:
predicate- the predicate- Returns:
- a reference to this, so the API can be used fluently
-
expect
public HttpRequest<T> expect(ResponsePredicate predicate)
Add an expectation that the response is valid according to the providedpredicate.Multiple predicates can be added.
- Parameters:
predicate- the predicate- Returns:
- a reference to this, so the API can be used fluently
-
expectations
public List<ResponsePredicate> expectations()
- Returns:
- a read-only list of the response predicate expectations
-
queryParams
public MultiMap queryParams()
Return the current query parameters.- Returns:
- the current query parameters
-
templateParams
public Variables templateParams()
Return the current request URI template parameters.- Returns:
- the current request URI template parameters
-
copy
public HttpRequest<T> copy()
Copy this request- Returns:
- a copy of this request
-
multipartMixed
public HttpRequest<T> multipartMixed(boolean allow)
Allow or disallow multipart mixed encoding when sending having files sharing the same file name.
The default value istrue.
Set tofalseif you want to achieve the behavior for HTML5.- Parameters:
allow-trueallows use of multipart mixed encoding- Returns:
- a reference to this, so the API can be used fluently
-
multipartMixed
public boolean multipartMixed()
- Returns:
- whether multipart mixed encoding is allowed
-
traceOperation
public HttpRequest<T> traceOperation(String traceOperation)
Trace operation name override.- Parameters:
traceOperation- Name of operation to use in traces- Returns:
- a reference to this, so the API can be used fluently
-
traceOperation
public String traceOperation()
- Returns:
- the trace operation name override
-
sendStream
public void sendStream(ReadStream<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.- Parameters:
body- the bodyhandler-
-
sendStream
public void sendStream(ReadStream<Buffer> body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.- Parameters:
body- the body
-
rxSendStream
public io.reactivex.Single<HttpResponse<T>> rxSendStream(ReadStream<Buffer> body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.- Parameters:
body- the body- Returns:
-
sendStream
public void sendStream(io.reactivex.Flowable<Buffer> body, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.- Parameters:
body- the bodyhandler-
-
sendStream
public void sendStream(io.reactivex.Flowable<Buffer> body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.- Parameters:
body- the body
-
rxSendStream
public io.reactivex.Single<HttpResponse<T>> rxSendStream(io.reactivex.Flowable<Buffer> body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodystream.- Parameters:
body- the body- Returns:
-
sendBuffer
public void sendBuffer(Buffer body, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodybuffer.- Parameters:
body- the bodyhandler-
-
sendBuffer
public void sendBuffer(Buffer body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodybuffer.- Parameters:
body- the body
-
rxSendBuffer
public io.reactivex.Single<HttpResponse<T>> rxSendBuffer(Buffer body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodybuffer.- Parameters:
body- the body- Returns:
-
sendJsonObject
public void sendJsonObject(JsonObject body, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.- Parameters:
body- the bodyhandler-
-
sendJsonObject
public void sendJsonObject(JsonObject body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.- Parameters:
body- the body
-
rxSendJsonObject
public io.reactivex.Single<HttpResponse<T>> rxSendJsonObject(JsonObject body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.- Parameters:
body- the body- Returns:
-
sendJson
public void sendJson(Object body, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.- Parameters:
body- the bodyhandler-
-
sendJson
public void sendJson(Object body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.- Parameters:
body- the body
-
rxSendJson
public io.reactivex.Single<HttpResponse<T>> rxSendJson(Object body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodyobject encoded as json and the content type set toapplication/json.- Parameters:
body- the body- Returns:
-
sendForm
public void sendForm(MultiMap body, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.When the content type header is previously set to
multipart/form-datait will be used instead.- Parameters:
body- the bodyhandler-
-
sendForm
public void sendForm(MultiMap body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.When the content type header is previously set to
multipart/form-datait will be used instead.- Parameters:
body- the body
-
rxSendForm
public io.reactivex.Single<HttpResponse<T>> rxSendForm(MultiMap body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.When the content type header is previously set to
multipart/form-datait will be used instead.- Parameters:
body- the body- Returns:
-
sendForm
public void sendForm(MultiMap body, String charset, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.When the content type header is previously set to
multipart/form-datait will be used instead. NOTE: the use of this method is strongly discouraged to use when the form is aapplication/x-www-form-urlencodedencoded form since the charset to use must be UTF-8.- Parameters:
body- the bodycharset-handler-
-
sendForm
public void sendForm(MultiMap body, String charset)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.When the content type header is previously set to
multipart/form-datait will be used instead. NOTE: the use of this method is strongly discouraged to use when the form is aapplication/x-www-form-urlencodedencoded form since the charset to use must be UTF-8.- Parameters:
body- the bodycharset-
-
rxSendForm
public io.reactivex.Single<HttpResponse<T>> rxSendForm(MultiMap body, String charset)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set toapplication/x-www-form-urlencoded.When the content type header is previously set to
multipart/form-datait will be used instead. NOTE: the use of this method is strongly discouraged to use when the form is aapplication/x-www-form-urlencodedencoded form since the charset to use must be UTF-8.- Parameters:
body- the bodycharset-- Returns:
-
sendMultipartForm
public void sendMultipartForm(MultipartForm body, Handler<AsyncResult<HttpResponse<T>>> handler)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set tomultipart/form-data. You may use this method to send attributes and upload files.- Parameters:
body- the bodyhandler-
-
sendMultipartForm
public void sendMultipartForm(MultipartForm body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set tomultipart/form-data. You may use this method to send attributes and upload files.- Parameters:
body- the body
-
rxSendMultipartForm
public io.reactivex.Single<HttpResponse<T>> rxSendMultipartForm(MultipartForm body)
Likesend(io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.ext.web.client.HttpResponse<T>>>)but with an HTTP requestbodymultimap encoded as form and the content type set tomultipart/form-data. You may use this method to send attributes and upload files.- Parameters:
body- the body- Returns:
-
send
public void send(Handler<AsyncResult<HttpResponse<T>>> handler)
Send a request, thehandlerwill receive the response as anHttpResponse.- Parameters:
handler-
-
send
public void send()
Send a request, thehandlerwill receive the response as anHttpResponse.
-
rxSend
public io.reactivex.Single<HttpResponse<T>> rxSend()
Send a request, thehandlerwill receive the response as anHttpResponse.- Returns:
-
putHeader
public HttpRequest<T> putHeader(String name, Iterable<String> value)
Configure the request to set a new HTTP header with multiple values.- Parameters:
name- the header namevalue- the header value- Returns:
- a reference to this, so the API can be used fluently
-
authentication
public HttpRequest<T> authentication(Credentials credentials)
Configure the request to perform HTTP Authentication.Performs a generic authentication using the credentials provided by the user. For the sake of validation safety it is recommended that is called to ensure that the credentials are applicable to the HTTP Challenged received on a previous request that returned a 401 response code.
- Parameters:
credentials- the credentials to use.- Returns:
- a reference to this, so the API can be used fluently
-
newInstance
public static <T> HttpRequest<T> newInstance(HttpRequest arg)
-
newInstance
public static <T> HttpRequest<T> newInstance(HttpRequest arg, TypeArg<T> __typeArg_T)
-
-