Skip to content

Commit 4920086

Browse files
committed
Remove deprecated web APIs
See gh-33809
1 parent 83c020e commit 4920086

File tree

38 files changed

+65
-1305
lines changed

38 files changed

+65
-1305
lines changed

spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
1717
package org.springframework.http.client.reactive;
1818

1919
import java.net.URI;
20-
import java.util.function.Consumer;
2120
import java.util.function.Function;
2221

2322
import org.eclipse.jetty.client.HttpClient;
@@ -76,21 +75,6 @@ public JettyClientHttpConnector(HttpClient httpClient, @Nullable JettyResourceFa
7675
this.httpClient = httpClient;
7776
}
7877

79-
/**
80-
* Constructor with an {@link JettyResourceFactory} that will manage shared resources.
81-
* @param resourceFactory the {@link JettyResourceFactory} to use
82-
* @param customizer the lambda used to customize the {@link HttpClient}
83-
* @deprecated as of 5.2, in favor of
84-
* {@link JettyClientHttpConnector#JettyClientHttpConnector(HttpClient, JettyResourceFactory)}
85-
*/
86-
@Deprecated
87-
public JettyClientHttpConnector(JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) {
88-
this(new HttpClient(), resourceFactory);
89-
if (customizer != null) {
90-
customizer.accept(this.httpClient);
91-
}
92-
}
93-
9478

9579
/**
9680
* Set the buffer factory to use.

spring-web/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpResponse.java

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import java.util.concurrent.atomic.AtomicInteger;
2121
import java.util.function.BiFunction;
2222

23-
import io.netty.buffer.ByteBufAllocator;
2423
import io.netty.handler.codec.http.cookie.Cookie;
2524
import io.netty.handler.codec.http.cookie.DefaultCookie;
2625
import org.apache.commons.logging.Log;
@@ -81,19 +80,6 @@ public ReactorClientHttpResponse(HttpClientResponse response, Connection connect
8180
this.bufferFactory = new NettyDataBufferFactory(connection.outbound().alloc());
8281
}
8382

84-
/**
85-
* Constructor with inputs extracted from a {@link Connection}.
86-
* @deprecated as of 5.2.8, in favor of {@link #ReactorClientHttpResponse(HttpClientResponse, Connection)}
87-
*/
88-
@Deprecated
89-
public ReactorClientHttpResponse(HttpClientResponse response, NettyInbound inbound, ByteBufAllocator alloc) {
90-
this.response = response;
91-
MultiValueMap<String, String> adapter = new Netty4HeadersAdapter(response.responseHeaders());
92-
this.headers = HttpHeaders.readOnlyHttpHeaders(adapter);
93-
this.inbound = inbound;
94-
this.bufferFactory = new NettyDataBufferFactory(alloc);
95-
}
96-
9783

9884
@Override
9985
public String getId() {

spring-web/src/main/java/org/springframework/http/codec/CodecConfigurer.java

+1-55
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -326,60 +326,6 @@ interface CustomCodecs {
326326
* @since 5.1.13
327327
*/
328328
void registerWithDefaultConfig(Object codec, Consumer<DefaultCodecConfig> configConsumer);
329-
330-
/**
331-
* Add a custom {@code Decoder} internally wrapped with
332-
* {@link DecoderHttpMessageReader}).
333-
* @param decoder the decoder to add
334-
* @deprecated as of 5.1.13, use {@link #register(Object)} or
335-
* {@link #registerWithDefaultConfig(Object)} instead.
336-
*/
337-
@Deprecated
338-
void decoder(Decoder<?> decoder);
339-
340-
/**
341-
* Add a custom {@code Encoder}, internally wrapped with
342-
* {@link EncoderHttpMessageWriter}.
343-
* @param encoder the encoder to add
344-
* @deprecated as of 5.1.13, use {@link #register(Object)} or
345-
* {@link #registerWithDefaultConfig(Object)} instead.
346-
*/
347-
@Deprecated
348-
void encoder(Encoder<?> encoder);
349-
350-
/**
351-
* Add a custom {@link HttpMessageReader}. For readers of type
352-
* {@link DecoderHttpMessageReader} consider using the shortcut
353-
* {@link #decoder(Decoder)} instead.
354-
* @param reader the reader to add
355-
* @deprecated as of 5.1.13, use {@link #register(Object)} or
356-
* {@link #registerWithDefaultConfig(Object)} instead.
357-
*/
358-
@Deprecated
359-
void reader(HttpMessageReader<?> reader);
360-
361-
/**
362-
* Add a custom {@link HttpMessageWriter}. For writers of type
363-
* {@link EncoderHttpMessageWriter} consider using the shortcut
364-
* {@link #encoder(Encoder)} instead.
365-
* @param writer the writer to add
366-
* @deprecated as of 5.1.13, use {@link #register(Object)} or
367-
* {@link #registerWithDefaultConfig(Object)} instead.
368-
*/
369-
@Deprecated
370-
void writer(HttpMessageWriter<?> writer);
371-
372-
/**
373-
* Register a callback for the {@link DefaultCodecConfig configuration}
374-
* applied to default codecs. This allows custom codecs to follow general
375-
* guidelines applied to default ones, such as logging details and limiting
376-
* the amount of buffered data.
377-
* @param codecsConfigConsumer the default codecs configuration callback
378-
* @deprecated as of 5.1.13, use {@link #registerWithDefaultConfig(Object)}
379-
* or {@link #registerWithDefaultConfig(Object, Consumer)} instead.
380-
*/
381-
@Deprecated
382-
void withDefaultCodecConfig(Consumer<DefaultCodecConfig> codecsConfigConsumer);
383329
}
384330

385331

spring-web/src/main/java/org/springframework/http/codec/support/BaseCodecConfigurer.java

+1-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -166,36 +166,6 @@ public void registerWithDefaultConfig(Object codec, Consumer<DefaultCodecConfig>
166166
this.defaultConfigConsumers.add(configConsumer);
167167
}
168168

169-
@SuppressWarnings("deprecation")
170-
@Override
171-
public void decoder(Decoder<?> decoder) {
172-
addCodec(decoder, false);
173-
}
174-
175-
@SuppressWarnings("deprecation")
176-
@Override
177-
public void encoder(Encoder<?> encoder) {
178-
addCodec(encoder, false);
179-
}
180-
181-
@SuppressWarnings("deprecation")
182-
@Override
183-
public void reader(HttpMessageReader<?> reader) {
184-
addCodec(reader, false);
185-
}
186-
187-
@SuppressWarnings("deprecation")
188-
@Override
189-
public void writer(HttpMessageWriter<?> writer) {
190-
addCodec(writer, false);
191-
}
192-
193-
@SuppressWarnings("deprecation")
194-
@Override
195-
public void withDefaultCodecConfig(Consumer<DefaultCodecConfig> codecsConfigConsumer) {
196-
this.defaultConfigConsumers.add(codecsConfigConsumer);
197-
}
198-
199169
private void addCodec(Object codec, boolean applyDefaultConfig) {
200170

201171
if (codec instanceof Decoder<?> decoder) {

spring-web/src/main/java/org/springframework/http/converter/HttpMessageNotReadableException.java

+1-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,29 +35,6 @@ public class HttpMessageNotReadableException extends HttpMessageConversionExcept
3535
private final @Nullable HttpInputMessage httpInputMessage;
3636

3737

38-
/**
39-
* Create a new HttpMessageNotReadableException.
40-
* @param msg the detail message
41-
* @deprecated as of 5.1, in favor of {@link #HttpMessageNotReadableException(String, HttpInputMessage)}
42-
*/
43-
@Deprecated
44-
public HttpMessageNotReadableException(String msg) {
45-
super(msg);
46-
this.httpInputMessage = null;
47-
}
48-
49-
/**
50-
* Create a new HttpMessageNotReadableException.
51-
* @param msg the detail message
52-
* @param cause the root cause (if any)
53-
* @deprecated as of 5.1, in favor of {@link #HttpMessageNotReadableException(String, Throwable, HttpInputMessage)}
54-
*/
55-
@Deprecated
56-
public HttpMessageNotReadableException(String msg, @Nullable Throwable cause) {
57-
super(msg, cause);
58-
this.httpInputMessage = null;
59-
}
60-
6138
/**
6239
* Create a new HttpMessageNotReadableException.
6340
* @param msg the detail message

spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -248,18 +248,6 @@ protected void dataReceived(T data) {
248248
*/
249249
protected abstract boolean write(T data) throws IOException;
250250

251-
/**
252-
* Invoked after the current data has been written and before requesting
253-
* the next item from the upstream, write Publisher.
254-
* <p>The default implementation is a no-op.
255-
* @deprecated originally introduced for Undertow to stop write notifications
256-
* when no data is available, but deprecated as of 5.0.6 since constant
257-
* switching on every requested item causes a significant slowdown.
258-
*/
259-
@Deprecated
260-
protected void writingPaused() {
261-
}
262-
263251
/**
264252
* Invoked after onComplete or onError notification.
265253
* <p>The default implementation is a no-op.
@@ -409,7 +397,6 @@ else if (processor.changeState(this, WRITING)) {
409397
processor.changeStateToReceived(REQUESTED);
410398
}
411399
else {
412-
processor.writingPaused();
413400
Assert.state(processor.subscription != null, "No subscription");
414401
processor.subscription.request(1);
415402
}

spring-web/src/main/java/org/springframework/http/server/reactive/AbstractServerHttpRequest.java

+1-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,21 +72,6 @@ public abstract class AbstractServerHttpRequest implements ServerHttpRequest {
7272
private @Nullable Supplier<Map<String, Object>> attributesSupplier;
7373

7474

75-
/**
76-
* Constructor with the method, URI and headers for the request.
77-
* @param method the HTTP method for the request
78-
* @param uri the URI for the request
79-
* @param contextPath the context path for the request
80-
* @param headers the headers for the request (as {@link MultiValueMap})
81-
* @since 6.0.8
82-
* @deprecated Use {@link #AbstractServerHttpRequest(HttpMethod, URI, String, HttpHeaders)}
83-
*/
84-
@Deprecated
85-
public AbstractServerHttpRequest(HttpMethod method, URI uri, @Nullable String contextPath,
86-
MultiValueMap<String, String> headers) {
87-
this(method, uri, contextPath, new HttpHeaders(headers));
88-
}
89-
9075
/**
9176
* Constructor with the method, URI and headers for the request.
9277
* @param method the HTTP method for the request

spring-web/src/main/java/org/springframework/web/client/DefaultResponseErrorHandler.java

+1-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -97,25 +97,6 @@ protected boolean hasError(HttpStatusCode statusCode) {
9797
return statusCode.isError();
9898
}
9999

100-
/**
101-
* Template method called from {@link #hasError(ClientHttpResponse)}.
102-
* <p>The default implementation checks if the given status code is
103-
* {@link org.springframework.http.HttpStatus.Series#CLIENT_ERROR CLIENT_ERROR} or
104-
* {@link org.springframework.http.HttpStatus.Series#SERVER_ERROR SERVER_ERROR}.
105-
* Can be overridden in subclasses.
106-
* @param statusCode the HTTP status code as raw value
107-
* @return {@code true} if the response indicates an error; {@code false} otherwise
108-
* @since 4.3.21
109-
* @see org.springframework.http.HttpStatus.Series#CLIENT_ERROR
110-
* @see org.springframework.http.HttpStatus.Series#SERVER_ERROR
111-
* @deprecated in favor of {@link #hasError(HttpStatusCode)}
112-
*/
113-
@Deprecated
114-
protected boolean hasError(int statusCode) {
115-
HttpStatus.Series series = HttpStatus.Series.resolve(statusCode);
116-
return (series == HttpStatus.Series.CLIENT_ERROR || series == HttpStatus.Series.SERVER_ERROR);
117-
}
118-
119100
/**
120101
* Handle the error in the given response with the given resolved status code
121102
* and extra information providing access to the request URL and HTTP method.

spring-web/src/main/java/org/springframework/web/client/RestTemplate.java

+1-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -823,24 +823,6 @@ else if (ext.getVarsMap() != null) {
823823
return doExecute(url, null, method, requestCallback, responseExtractor);
824824
}
825825

826-
/**
827-
* Execute the given method on the provided URI.
828-
* <p>The {@link ClientHttpRequest} is processed using the {@link RequestCallback};
829-
* the response with the {@link ResponseExtractor}.
830-
* @param url the fully-expanded URL to connect to
831-
* @param method the HTTP method to execute (GET, POST, etc.)
832-
* @param requestCallback object that prepares the request (can be {@code null})
833-
* @param responseExtractor object that extracts the return value from the response (can be {@code null})
834-
* @return an arbitrary object, as returned by the {@link ResponseExtractor}
835-
* @deprecated in favor of {@link #doExecute(URI, String, HttpMethod, RequestCallback, ResponseExtractor)}
836-
*/
837-
@Deprecated
838-
protected <T> @Nullable T doExecute(URI url, @Nullable HttpMethod method, @Nullable RequestCallback requestCallback,
839-
@Nullable ResponseExtractor<T> responseExtractor) throws RestClientException {
840-
841-
return doExecute(url, null, method, requestCallback, responseExtractor);
842-
}
843-
844826
/**
845827
* Execute the given method on the provided URI.
846828
* <p>The {@link ClientHttpRequest} is processed using the {@link RequestCallback};

spring-web/src/main/java/org/springframework/web/cors/UrlBasedCorsConfigurationSource.java

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,8 +62,6 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource
6262

6363
private PathMatcher pathMatcher = defaultPathMatcher;
6464

65-
private @Nullable String lookupPathAttributeName;
66-
6765
private boolean allowInitLookupPath = true;
6866

6967
private final Map<PathPattern, CorsConfiguration> corsConfigurations = new LinkedHashMap<>();
@@ -180,19 +178,6 @@ public void setAllowInitLookupPath(boolean allowInitLookupPath) {
180178
this.allowInitLookupPath = allowInitLookupPath;
181179
}
182180

183-
/**
184-
* Configure the name of the attribute that holds the lookupPath extracted
185-
* via {@link UrlPathHelper#getLookupPathForRequest(HttpServletRequest)}.
186-
* <p>By default this is {@link UrlPathHelper#PATH_ATTRIBUTE}.
187-
* @param name the request attribute to check
188-
* @since 5.2
189-
* @deprecated as of 5.3 in favor of {@link UrlPathHelper#PATH_ATTRIBUTE}.
190-
*/
191-
@Deprecated
192-
public void setLookupPathAttributeName(String name) {
193-
this.lookupPathAttributeName = name;
194-
}
195-
196181
/**
197182
* Configure a {@code PathMatcher} to use for pattern matching.
198183
* <p>This is an advanced property that should be used only when a
@@ -262,12 +247,9 @@ public Map<String, CorsConfiguration> getCorsConfigurations() {
262247
return null;
263248
}
264249

265-
@SuppressWarnings("deprecation")
266250
private Object resolvePath(HttpServletRequest request) {
267251
if (this.allowInitLookupPath && !ServletRequestPathUtils.hasCachedPath(request)) {
268-
return (this.lookupPathAttributeName != null ?
269-
this.urlPathHelper.getLookupPathForRequest(request, this.lookupPathAttributeName) :
270-
this.urlPathHelper.getLookupPathForRequest(request));
252+
return this.urlPathHelper.getLookupPathForRequest(request);
271253
}
272254
Object lookupPath = ServletRequestPathUtils.getCachedPath(request);
273255
if (this.pathMatcher != defaultPathMatcher) {

0 commit comments

Comments
 (0)