Deprecate OkHttp3ClientHttpRequestFactory
Closes gh-30919
This commit is contained in:
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Roy Clarkson
|
||||
* @since 4.3
|
||||
*/
|
||||
@Deprecated(since = "6.1", forRemoval = true)
|
||||
class OkHttp3ClientHttpRequest extends AbstractStreamingClientHttpRequest {
|
||||
|
||||
private final OkHttpClient client;
|
||||
@@ -67,6 +68,7 @@ class OkHttp3ClientHttpRequest extends AbstractStreamingClientHttpRequest {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
protected ClientHttpResponse executeInternal(HttpHeaders headers, @Nullable Body body) throws IOException {
|
||||
|
||||
RequestBody requestBody;
|
||||
|
||||
@@ -36,7 +36,10 @@ import org.springframework.util.Assert;
|
||||
* @author Arjen Poutsma
|
||||
* @author Roy Clarkson
|
||||
* @since 4.3
|
||||
* @deprecated since 6.1, in favor of other {@link ClientHttpRequestFactory}
|
||||
* implementations; scheduled for removal in 6.2
|
||||
*/
|
||||
@Deprecated(since = "6.1", forRemoval = true)
|
||||
public class OkHttp3ClientHttpRequestFactory implements ClientHttpRequestFactory, DisposableBean {
|
||||
|
||||
private OkHttpClient client;
|
||||
@@ -128,6 +131,7 @@ public class OkHttp3ClientHttpRequestFactory implements ClientHttpRequestFactory
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) {
|
||||
return new OkHttp3ClientHttpRequest(this.client, uri, httpMethod);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.util.Assert;
|
||||
* @author Roy Clarkson
|
||||
* @since 4.3
|
||||
*/
|
||||
@Deprecated(since = "6.1", forRemoval = true)
|
||||
class OkHttp3ClientHttpResponse implements ClientHttpResponse {
|
||||
|
||||
private final Response response;
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.http.client.JdkClientHttpRequestFactory;
|
||||
import org.springframework.http.client.JettyClientHttpRequestFactory;
|
||||
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
@@ -363,9 +362,6 @@ final class DefaultRestClientBuilder implements RestClient.Builder {
|
||||
else if (httpComponentsClientPresent) {
|
||||
return new HttpComponentsClientHttpRequestFactory();
|
||||
}
|
||||
else if (okHttpClientPresent) {
|
||||
return new OkHttp3ClientHttpRequestFactory();
|
||||
}
|
||||
else if (jettyClientPresent) {
|
||||
return new JettyClientHttpRequestFactory();
|
||||
}
|
||||
|
||||
@@ -348,7 +348,6 @@ public interface RestClient {
|
||||
* client library (e.g. SSL).
|
||||
* <p>If no request factory is specified, {@code RestClient} uses
|
||||
* {@linkplain org.springframework.http.client.HttpComponentsClientHttpRequestFactory Apache Http Client},
|
||||
* {@linkplain org.springframework.http.client.OkHttp3ClientHttpRequestFactory OkHttp 3}, or
|
||||
* {@linkplain org.springframework.http.client.JettyClientHttpRequestFactory Jetty Http Client}
|
||||
* if available on the classpath, and defaults to the
|
||||
* {@linkplain org.springframework.http.client.JdkClientHttpRequestFactory JDK HttpClient}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.http.HttpMethod;
|
||||
*/
|
||||
public class OkHttp3ClientHttpRequestFactoryTests extends AbstractHttpRequestFactoryTests {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
protected ClientHttpRequestFactory createRequestFactory() {
|
||||
return new OkHttp3ClientHttpRequestFactory();
|
||||
|
||||
@@ -72,6 +72,7 @@ class RestClientIntegrationTests {
|
||||
@interface ParameterizedRestClientTest {
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static Stream<Named<ClientHttpRequestFactory>> clientHttpRequestFactories() {
|
||||
return Stream.of(
|
||||
named("JDK HttpURLConnection", new SimpleClientHttpRequestFactory()),
|
||||
|
||||
@@ -91,6 +91,7 @@ class RestTemplateIntegrationTests extends AbstractMockWebServerTests {
|
||||
@interface ParameterizedRestTemplateTest {
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static Stream<Named<ClientHttpRequestFactory>> clientHttpRequestFactories() {
|
||||
return Stream.of(
|
||||
named("JDK HttpURLConnection", new SimpleClientHttpRequestFactory()),
|
||||
|
||||
Reference in New Issue
Block a user