Class RestClient


  • public final class RestClient
    extends Object
    An instance of this class stores the client information for making REST calls.
    • Method Detail

      • serializerAdapter

        public SerializerAdapter<?> serializerAdapter()
        Returns:
        the current serializer adapter.
      • responseBuilderFactory

        public ResponseBuilder.Factory responseBuilderFactory()
        Returns:
        the current respnose builder factory.
      • httpClient

        public okhttp3.OkHttpClient httpClient()
        Returns:
        the OkHttpClient instance
      • retrofit

        public retrofit2.Retrofit retrofit()
        Returns:
        the Retrofit instance
      • logLevel

        public LogLevel logLevel()
        Returns:
        the current HTTP traffic logging level
      • withLogLevel

        public RestClient withLogLevel​(LogLevel logLevel)
        Set the current HTTP traffic logging level.
        Parameters:
        logLevel - the logging level enum
        Returns:
        the RestClient itself
      • newBuilder

        public RestClient.Builder newBuilder()
        Create a new builder for a new Rest Client with the same configurations on this one.
        Returns:
        a RestClient builder
      • close

        @Beta(V1_1_0)
        public void close()
        Closes the HTTP client and recycles the resources associated. The threads will be recycled after 60 seconds of inactivity.
      • closeAndWait

        @Beta(V1_1_0)
        public void closeAndWait()
                          throws InterruptedException
        Closes the HTTP client, recycles the resources associated, and waits for 60 seconds for all the threads to be recycled.
        Throws:
        InterruptedException - thrown when the 60-sec wait is interrupted