Remove APIs deprecated for removal in 6.1

This is the first commit that removes deprecated APIs.

Subsequent commits will remove additional deprecated APIs.

See gh-29449
This commit is contained in:
Sam Brannen
2023-04-19 17:23:49 +02:00
parent d446de62a4
commit 7df2e2a8d2
13 changed files with 58 additions and 508 deletions

View File

@@ -127,19 +127,6 @@ public final class HttpMethod implements Comparable<HttpMethod>, Serializable {
};
}
/**
* Resolve the given method value to an {@code HttpMethod}.
* @param method the method value as a String
* @return the corresponding {@code HttpMethod}, or {@code null} if not found
* @since 4.2.4
* @deprecated in favor of {@link #valueOf(String)}
*/
@Nullable
@Deprecated(since = "6.0", forRemoval = true)
public static HttpMethod resolve(@Nullable String method) {
return (method != null ? valueOf(method) : null);
}
/**
* Return the name of this method, e.g. "GET", "POST".

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 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.
@@ -34,19 +34,6 @@ public interface HttpRequest extends HttpMessage {
*/
HttpMethod getMethod();
/**
* Return the HTTP method of the request as a String value.
* @return the HTTP method as a plain String
* @since 5.0
* @see #getMethod()
* @deprecated as of Spring Framework 6.0 in favor of {@link #getMethod()} and
* {@link HttpMethod#name()}
*/
@Deprecated(since = "6.0", forRemoval = true)
default String getMethodValue() {
return getMethod().name();
}
/**
* Return the URI of the request (including a query string if any,
* but only if it is well-formed for a URI representation).

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 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.
@@ -22,8 +22,6 @@ import java.net.URI;
import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.classic.HttpClient;
import org.apache.hc.client5.http.classic.methods.HttpDelete;
import org.apache.hc.client5.http.classic.methods.HttpGet;
@@ -41,7 +39,6 @@ import org.apache.hc.client5.http.protocol.HttpClientContext;
import org.apache.hc.core5.http.ClassicHttpRequest;
import org.apache.hc.core5.http.io.SocketConfig;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.Timeout;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.http.HttpMethod;
@@ -66,9 +63,6 @@ import org.springframework.util.Assert;
*/
public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequestFactory, DisposableBean {
private static final Log logger = LogFactory.getLog(HttpComponentsClientHttpRequestFactory.class);
private HttpClient httpClient;
private boolean bufferRequestBody = true;
@@ -147,21 +141,6 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest
this.connectionRequestTimeout = connectionRequestTimeout;
}
/**
* As of version 6.0, setting this property has no effect.
* <p>To change the socket read timeout, use {@link SocketConfig.Builder#setSoTimeout(Timeout)},
* supply the resulting {@link SocketConfig} to
* {@link org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder#setDefaultSocketConfig(SocketConfig)},
* use the resulting connection manager for
* {@link org.apache.hc.client5.http.impl.classic.HttpClientBuilder#setConnectionManager(HttpClientConnectionManager)},
* and supply the built {@link HttpClient} to {@link #HttpComponentsClientHttpRequestFactory(HttpClient)}.
* @deprecated as of 6.0, in favor of {@link SocketConfig.Builder#setSoTimeout(Timeout)}, see above.
*/
@Deprecated(since = "6.0", forRemoval = true)
public void setReadTimeout(int timeout) {
logger.warn("HttpComponentsClientHttpRequestFactory.setReadTimeout has no effect");
}
/**
* Indicates whether this request factory should buffer the request body internally.
* <p>Default is {@code true}. When sending large amounts of data via POST or PUT, it is

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 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.
@@ -46,18 +46,6 @@ public interface ClientHttpResponse extends ReactiveHttpInputMessage {
*/
HttpStatusCode getStatusCode();
/**
* Return the HTTP status code as an integer.
* @return the HTTP status as an integer value
* @since 5.0.6
* @see #getStatusCode()
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
*/
@Deprecated(since = "6.0", forRemoval = true)
default int getRawStatusCode() {
return getStatusCode().value();
}
/**
* Return a read-only map of response cookies received from the server.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 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.
@@ -36,6 +36,7 @@ import org.springframework.util.StringUtils;
* specific request method.
*
* @author Juergen Hoeller
* @author Sam Brannen
* @since 2.0
*/
@SuppressWarnings("serial")
@@ -50,7 +51,7 @@ public class HttpRequestMethodNotSupportedException extends ServletException imp
/**
* Create a new HttpRequestMethodNotSupportedException.
* Create a new {@code HttpRequestMethodNotSupportedException}.
* @param method the unsupported HTTP request method
*/
public HttpRequestMethodNotSupportedException(String method) {
@@ -58,18 +59,7 @@ public class HttpRequestMethodNotSupportedException extends ServletException imp
}
/**
* Create a new HttpRequestMethodNotSupportedException.
* @param method the unsupported HTTP request method
* @param msg the detail message
* @deprecated in favor of {@link #HttpRequestMethodNotSupportedException(String, Collection)}
*/
@Deprecated(since = "6.0", forRemoval = true)
public HttpRequestMethodNotSupportedException(String method, String msg) {
this(method, null, msg);
}
/**
* Create a new HttpRequestMethodNotSupportedException.
* Create a new {@code HttpRequestMethodNotSupportedException}.
* @param method the unsupported HTTP request method
* @param supportedMethods the actually supported HTTP methods (possibly {@code null})
*/
@@ -78,26 +68,12 @@ public class HttpRequestMethodNotSupportedException extends ServletException imp
}
/**
* Create a new HttpRequestMethodNotSupportedException.
* Create a new {@code HttpRequestMethodNotSupportedException}.
* @param method the unsupported HTTP request method
* @param supportedMethods the actually supported HTTP methods (possibly {@code null})
* @deprecated in favor of {@link #HttpRequestMethodNotSupportedException(String, Collection)}
*/
@Deprecated(since = "6.0", forRemoval = true)
public HttpRequestMethodNotSupportedException(String method, @Nullable String[] supportedMethods) {
this(method, supportedMethods, "Request method '" + method + "' is not supported");
}
/**
* Create a new HttpRequestMethodNotSupportedException.
* @param method the unsupported HTTP request method
* @param supportedMethods the actually supported HTTP methods
* @param msg the detail message
* @deprecated in favor of {@link #HttpRequestMethodNotSupportedException(String, Collection)}
*/
@Deprecated(since = "6.0", forRemoval = true)
public HttpRequestMethodNotSupportedException(String method, @Nullable String[] supportedMethods, String msg) {
super(msg);
private HttpRequestMethodNotSupportedException(String method, @Nullable String[] supportedMethods) {
super("Request method '" + method + "' is not supported");
this.method = method;
this.supportedMethods = supportedMethods;