Class WebClientSession


  • public class WebClientSession
    extends WebClient
    An asynchronous sessions aware HTTP / HTTP/2 client called WebClientSession.

    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

    NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.

    • Field Detail

      • __TYPE_ARG

        public static final io.vertx.lang.rx.TypeArg<WebClientSession> __TYPE_ARG
    • Constructor Detail

      • WebClientSession

        public WebClientSession​(Object delegate)
    • Method Detail

      • create

        public static WebClientSession create​(WebClient webClient)
        Create a session aware web client using the provided webClient instance.
        Parameters:
        webClient - the web client instance
        Returns:
        the created client
      • addHeader

        public WebClientSession addHeader​(String name,
                                          String value)
        Configure the client to add an HTTP header to every request.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        a reference to this, so the API can be used fluently
      • removeHeader

        public 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
      • create

        public static WebClientSession create​(WebClient webClient,
                                              CookieStore cookieStore)
        Create a session aware web client using the provided webClient instance.
        Parameters:
        webClient - the web client instance
        cookieStore -
        Returns:
        the created client
      • addHeader

        public WebClientSession addHeader​(CharSequence name,
                                          CharSequence value)
        Configure the client to add an HTTP header to every request.
        Parameters:
        name - the header name
        value - the header value
        Returns:
        a reference to this, so the API can be used fluently
      • addHeader

        public WebClientSession addHeader​(CharSequence name,
                                          Iterable<CharSequence> values)
        Configure the client to add an HTTP header to every request.
        Parameters:
        name - the header name
        values - the header value
        Returns:
        a reference to this, so the API can be used fluently
      • addHeader

        public WebClientSession addHeader​(String name,
                                          Iterable<String> values)
        Configure the client to add an HTTP header to every request.
        Parameters:
        name - the header name
        values - the header value
        Returns:
        a reference to this, so the API can be used fluently
      • removeHeader

        public 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
      • cookieStore

        public CookieStore cookieStore()
        Returns this client's CookieStore

        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