com.microsoft.rest.interceptors.LoggingInterceptor Java Examples

The following examples show how to use com.microsoft.rest.interceptors.LoggingInterceptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestClient.java    From autorest-clientruntime-for-java with MIT License 6 votes vote down vote up
/**
 * Creates an instance of the builder with a base URL and 2 custom builders.
 *
 * @param httpClientBuilder the builder to build an {@link OkHttpClient}.
 * @param retrofitBuilder the builder to build a {@link Retrofit}.
 */
public Builder(OkHttpClient.Builder httpClientBuilder, Retrofit.Builder retrofitBuilder) {
    if (httpClientBuilder == null) {
        throw new IllegalArgumentException("httpClientBuilder == null");
    }
    if (retrofitBuilder == null) {
        throw new IllegalArgumentException("retrofitBuilder == null");
    }
    CookieManager cookieManager = new CookieManager();
    cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
    customHeadersInterceptor = new CustomHeadersInterceptor();
    // Set up OkHttp client
    this.httpClientBuilder = httpClientBuilder
            .cookieJar(new JavaNetCookieJar(cookieManager))
            .readTimeout(120, TimeUnit.SECONDS)
            .connectTimeout(60, TimeUnit.SECONDS)
            .addInterceptor(new RequestIdHeaderInterceptor())
            .addInterceptor(new BaseUrlHandler());
    this.retrofitBuilder = retrofitBuilder;
    this.loggingInterceptor = new LoggingInterceptor(LogLevel.NONE);
    this.useHttpClientThreadPool = false;
}
 
Example #2
Source File: ITManagedStorageAccountKey.java    From azure-keyvault-java with MIT License 5 votes vote down vote up
protected RestClient buildPlaybackRestClient(ServiceClientCredentials credentials, String baseUrl)
        throws IOException {
    return new RestClient.Builder().withBaseUrl(baseUrl)
            .withSerializerAdapter(new AzureJacksonAdapter())
            .withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials)
            .withLogLevel(LogLevel.NONE).withNetworkInterceptor(new LoggingInterceptor(LogLevel.BODY_AND_HEADERS))
            .withNetworkInterceptor(interceptorManager.initInterceptor())
            .withInterceptor(new ResourceManagerThrottlingInterceptor()).build();
}
 
Example #3
Source File: KeyVaultClientIntegrationTestBase.java    From azure-keyvault-java with MIT License 5 votes vote down vote up
protected RestClient buildPlaybackRestClient(ServiceClientCredentials credentials, String baseUrl) throws IOException {
	return buildRestClient(new RestClient.Builder().withBaseUrl(baseUrl)
				.withSerializerAdapter(new AzureJacksonAdapter())
				.withResponseBuilderFactory(new AzureResponseBuilder.Factory()).withCredentials(credentials)
				.withLogLevel(LogLevel.NONE)
				.withNetworkInterceptor(new LoggingInterceptor(LogLevel.BODY_AND_HEADERS))
				.withNetworkInterceptor(interceptorManager.initInterceptor())
				.withInterceptor(new ResourceManagerThrottlingInterceptor()));
}
 
Example #4
Source File: CBRefreshTokenClient.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
public CBRefreshTokenClient(String baseUrl) {
    OkHttpClient.Builder builder = new OkHttpClient.Builder().addInterceptor(new LoggingInterceptor(LogLevel.BODY_AND_HEADERS));
    builder.proxyAuthenticator(new JavaNetAuthenticator());
    service = new Builder()
            .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
            .addConverterFactory(new JacksonAdapter().converterFactory())
            .baseUrl(baseUrl)
            .client(builder.build())
            .build().create(RefreshTokenService.class);
}