Class QuarkusRestClientBuilderImpl

    • Constructor Detail

    • Method Detail

      • baseUrl

        public QuarkusRestClientBuilder baseUrl​(URL url)
        Description copied from interface: QuarkusRestClientBuilder
        Specifies the base URL to be used when making requests. Assuming that the interface has a @Path("/api") at the interface level and a url is given with http://my-service:8080/service then all REST calls will be invoked with a url of http://my-service:8080/service/api in addition to any @Path annotations included on the method. Subsequent calls to this method will replace the previously specified baseUri/baseUrl.
        Specified by:
        baseUrl in interface QuarkusRestClientBuilder
        Parameters:
        url - the base Url for the service.
        Returns:
        the current builder with the baseUrl set.
      • baseUri

        public QuarkusRestClientBuilder baseUri​(URI uri)
        Description copied from interface: QuarkusRestClientBuilder
        Specifies the base URI to be used when making requests. Assuming that the interface has a @Path("/api") at the interface level and a uri is given with http://my-service:8080/service then all REST calls will be invoked with a uri of http://my-service:8080/service/api in addition to any @Path annotations included on the method. Subsequent calls to this method will replace the previously specified baseUri/baseUrl.
        Specified by:
        baseUri in interface QuarkusRestClientBuilder
        Parameters:
        uri - the base URI for the service.
        Returns:
        the current builder with the baseUri set
      • connectTimeout

        public QuarkusRestClientBuilder connectTimeout​(long timeout,
                                                       TimeUnit unit)
        Description copied from interface: QuarkusRestClientBuilder
        Set the connect timeout.

        Like JAX-RS's jakarta.ws.rs.client.ClientBuilder's connectTimeout method, specifying a timeout of 0 represents infinity, and negative values are not allowed.

        If the client instance is injected via CDI and the "fully.qualified.InterfaceName/mp-rest/connectTimeout" property is set via MicroProfile Config, that property's value will override, the value specified to this method.

        Specified by:
        connectTimeout in interface QuarkusRestClientBuilder
        Parameters:
        timeout - the maximum time to wait.
        unit - the time unit of the timeout argument.
        Returns:
        the current builder with the connect timeout set.
      • readTimeout

        public QuarkusRestClientBuilder readTimeout​(long timeout,
                                                    TimeUnit unit)
        Description copied from interface: QuarkusRestClientBuilder
        Set the read timeout.

        Like JAX-RS's jakarta.ws.rs.client.ClientBuilder's readTimeout method, specifying a timeout of 0 represents infinity, and negative values are not allowed.

        Also like the JAX-RS Client API, if the read timeout is reached, the client interface method will throw a jakarta.ws.rs.ProcessingException.

        If the client instance is injected via CDI and the "fully.qualified.InterfaceName/mp-rest/readTimeout" property is set via MicroProfile Config, that property's value will override, the value specified to this method.

        Specified by:
        readTimeout in interface QuarkusRestClientBuilder
        Parameters:
        timeout - the maximum time to wait.
        unit - the time unit of the timeout argument.
        Returns:
        the current builder with the connect timeout set.
      • sslContext

        public QuarkusRestClientBuilder sslContext​(SSLContext sslContext)
        Description copied from interface: QuarkusRestClientBuilder
        Specifies the SSL context to use when creating secured transport connections to server endpoints from web targets created by the client instance that is using this SSL context.
        Specified by:
        sslContext in interface QuarkusRestClientBuilder
        Parameters:
        sslContext - the ssl context
        Returns:
        the current builder with ssl context set
      • followRedirects

        public QuarkusRestClientBuilder followRedirects​(boolean follow)
        Description copied from interface: QuarkusRestClientBuilder
        Specifies whether client built by this builder should follow HTTP redirect responses (30x) or not.
        Specified by:
        followRedirects in interface QuarkusRestClientBuilder
        Parameters:
        follow - true if the client should follow HTTP redirects, false if not.
        Returns:
        the current builder with the followRedirect property set.
      • proxyAddress

        public QuarkusRestClientBuilder proxyAddress​(String proxyHost,
                                                     int proxyPort)
        Description copied from interface: QuarkusRestClientBuilder
        Specifies the HTTP proxy hostname/IP address and port to use for requests from client instances.
        Specified by:
        proxyAddress in interface QuarkusRestClientBuilder
        Parameters:
        proxyHost - hostname or IP address of proxy server - must be non-null
        proxyPort - port of proxy server
        Returns:
        the current builder with the proxy host set
      • queryParamStyle

        public QuarkusRestClientBuilder queryParamStyle​(org.eclipse.microprofile.rest.client.ext.QueryParamStyle style)
        Description copied from interface: QuarkusRestClientBuilder
        Specifies the URI formatting style to use when multiple query parameter values are passed to the client.
        Specified by:
        queryParamStyle in interface QuarkusRestClientBuilder
        Parameters:
        style - the URI formatting style to use for multiple query parameter values
        Returns:
        the current builder with the style of query params set
      • getConfiguration

        public jakarta.ws.rs.core.Configuration getConfiguration()
        Specified by:
        getConfiguration in interface jakarta.ws.rs.core.Configurable<QuarkusRestClientBuilder>
      • build

        public <T> T build​(Class<T> clazz)
                    throws IllegalStateException,
                           org.eclipse.microprofile.rest.client.RestClientDefinitionException
        Description copied from interface: QuarkusRestClientBuilder
        Based on the configured QuarkusRestClientBuilder, creates a new instance of the given REST interface to invoke API calls against.
        Specified by:
        build in interface QuarkusRestClientBuilder
        Type Parameters:
        T - the type of the interface
        Parameters:
        clazz - the interface that defines REST API methods for use
        Returns:
        a new instance of an implementation of this REST interface that
        Throws:
        IllegalStateException - if not all pre-requisites are satisfied for the builder, this exception may get thrown. For instance, if the base URI/URL has not been set.
        org.eclipse.microprofile.rest.client.RestClientDefinitionException - if the passed-in interface class is invalid.