Package io.vertx.ext.web.client
Interface WebClientSession
-
- All Superinterfaces:
WebClient
public interface WebClientSession extends WebClient
An asynchronous sessions aware HTTP / HTTP/2 client calledWebClientSession
.This client wraps a
WebClient
and makes it session aware adding features to it:- Per client headers, to be send with every request
- Per client cookies, to be send with every request
- Automatic storage and sending of cookies received from the server(s)
The client honors the cookies attributes:
- domain
- path
- secure
- max-age and expires
- Author:
- Tommaso Nolli
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description WebClientSession
addHeader(CharSequence name, CharSequence value)
Configure the client to add an HTTP header to every request.WebClientSession
addHeader(CharSequence name, Iterable<CharSequence> values)
Configure the client to add an HTTP header to every request.WebClientSession
addHeader(String name, Iterable<String> values)
Configure the client to add an HTTP header to every request.WebClientSession
addHeader(String name, String value)
Configure the client to add an HTTP header to every request.WebClientSession
addInterceptor(Handler<io.vertx.ext.web.client.impl.HttpContext<?>> interceptor)
Add interceptor in the chain.CookieStore
cookieStore()
Returns this client'sCookieStore
static WebClientSession
create(WebClient webClient)
Create a session aware web client using the providedwebClient
instance.static WebClientSession
create(WebClient webClient, CookieStore cookieStore)
Create a session aware web client using the providedwebClient
instance.WebClientSession
removeHeader(CharSequence name)
Removes a previously added header.WebClientSession
removeHeader(String name)
Removes a previously added header.-
Methods inherited from interface io.vertx.ext.web.client.WebClient
close, delete, delete, delete, delete, delete, delete, deleteAbs, deleteAbs, get, get, get, get, get, get, getAbs, getAbs, head, head, head, head, head, head, headAbs, headAbs, patch, patch, patch, patch, patch, patch, patchAbs, patchAbs, post, post, post, post, post, post, postAbs, postAbs, put, put, put, put, put, put, putAbs, putAbs, request, request, request, request, request, request, request, request, request, request, request, request, request, request, requestAbs, requestAbs, requestAbs, requestAbs, updateSSLOptions, updateSSLOptions
-
-
-
-
Method Detail
-
create
static WebClientSession create(WebClient webClient)
Create a session aware web client using the providedwebClient
instance.- Parameters:
webClient
- the web client instance- Returns:
- the created client
-
create
static WebClientSession create(WebClient webClient, CookieStore cookieStore)
Create a session aware web client using the providedwebClient
instance.- Parameters:
webClient
- the web client instance- Returns:
- the created client
-
addHeader
WebClientSession addHeader(CharSequence name, CharSequence value)
Configure the client to add an HTTP header to every request.- Parameters:
name
- the header namevalue
- the header value- Returns:
- a reference to this, so the API can be used fluently
-
addHeader
WebClientSession addHeader(String name, String value)
Configure the client to add an HTTP header to every request.- Parameters:
name
- the header namevalue
- the header value- Returns:
- a reference to this, so the API can be used fluently
-
addHeader
WebClientSession addHeader(CharSequence name, Iterable<CharSequence> values)
Configure the client to add an HTTP header to every request.- Parameters:
name
- the header namevalues
- the header value- Returns:
- a reference to this, so the API can be used fluently
-
addHeader
WebClientSession addHeader(String name, Iterable<String> values)
Configure the client to add an HTTP header to every request.- Parameters:
name
- the header namevalues
- the header value- Returns:
- a reference to this, so the API can be used fluently
-
removeHeader
WebClientSession removeHeader(CharSequence name)
Removes a previously added header.- Parameters:
name
- the header name- Returns:
- a reference to this, so the API can be used fluently
-
removeHeader
WebClientSession removeHeader(String name)
Removes a previously added header.- Parameters:
name
- the header name- Returns:
- a reference to this, so the API can be used fluently
-
cookieStore
CookieStore cookieStore()
Returns this client'sCookieStore
All cookies added to this store will be sent with every request. The CookieStore honors the domain, path, secure and max-age properties of received cookies and is automatically updated with cookies present in responses received by this client.
- Returns:
- this client's cookie store
-
addInterceptor
WebClientSession addInterceptor(Handler<io.vertx.ext.web.client.impl.HttpContext<?>> interceptor)
Description copied from interface:WebClient
Add interceptor in the chain. The interceptor can maintain per request state withHttpContext.get(String)
/HttpContext.set(String, Object)
. A request/response can be processed several times (in case of retry) and thus they should use the per request state to ensure an operation is not done twice. This API is internal.- Specified by:
addInterceptor
in interfaceWebClient
- Parameters:
interceptor
- the interceptor to add, must not be null- Returns:
- a reference to this, so the API can be used fluently
-
-