Package com.microsoft.rest
Class RestClient
- java.lang.Object
-
- com.microsoft.rest.RestClient
-
public final class RestClient extends Object
An instance of this class stores the client information for making REST calls.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRestClient.BuilderThe builder class for building a REST client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the HTTP client and recycles the resources associated.voidcloseAndWait()Closes the HTTP client, recycles the resources associated, and waits for 60 seconds for all the threads to be recycled.ServiceClientCredentialscredentials()CustomHeadersInterceptorheaders()okhttp3.OkHttpClienthttpClient()LogLevellogLevel()RestClient.BuildernewBuilder()Create a new builder for a new Rest Client with the same configurations on this one.ResponseBuilder.FactoryresponseBuilderFactory()retrofit2.Retrofitretrofit()SerializerAdapter<?>serializerAdapter()RestClientwithLogLevel(LogLevel logLevel)Set the current HTTP traffic logging level.
-
-
-
Method Detail
-
headers
public CustomHeadersInterceptor headers()
- Returns:
- the headers interceptor.
-
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
OkHttpClientinstance
-
retrofit
public retrofit2.Retrofit retrofit()
- Returns:
- the
Retrofitinstance
-
credentials
public ServiceClientCredentials credentials()
- Returns:
- the credentials attached to this REST client
-
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 InterruptedExceptionCloses 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
-
-