Skip to content

Commit

Permalink
Remove deprecated web APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoyanchev committed Jan 15, 2025
1 parent 83c020e commit 4920086
Show file tree
Hide file tree
Showing 38 changed files with 65 additions and 1,305 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
Expand All @@ -17,7 +17,6 @@
package org.springframework.http.client.reactive;

import java.net.URI;
import java.util.function.Consumer;
import java.util.function.Function;

import org.eclipse.jetty.client.HttpClient;
Expand Down Expand Up @@ -76,21 +75,6 @@ public JettyClientHttpConnector(HttpClient httpClient, @Nullable JettyResourceFa
this.httpClient = httpClient;
}

/**
* Constructor with an {@link JettyResourceFactory} that will manage shared resources.
* @param resourceFactory the {@link JettyResourceFactory} to use
* @param customizer the lambda used to customize the {@link HttpClient}
* @deprecated as of 5.2, in favor of
* {@link JettyClientHttpConnector#JettyClientHttpConnector(HttpClient, JettyResourceFactory)}
*/
@Deprecated
public JettyClientHttpConnector(JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) {
this(new HttpClient(), resourceFactory);
if (customizer != null) {
customizer.accept(this.httpClient);
}
}


/**
* Set the buffer factory to use.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2025 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.
Expand All @@ -20,7 +20,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiFunction;

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

/**
* Constructor with inputs extracted from a {@link Connection}.
* @deprecated as of 5.2.8, in favor of {@link #ReactorClientHttpResponse(HttpClientResponse, Connection)}
*/
@Deprecated
public ReactorClientHttpResponse(HttpClientResponse response, NettyInbound inbound, ByteBufAllocator alloc) {
this.response = response;
MultiValueMap<String, String> adapter = new Netty4HeadersAdapter(response.responseHeaders());
this.headers = HttpHeaders.readOnlyHttpHeaders(adapter);
this.inbound = inbound;
this.bufferFactory = new NettyDataBufferFactory(alloc);
}


@Override
public String getId() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -326,60 +326,6 @@ interface CustomCodecs {
* @since 5.1.13
*/
void registerWithDefaultConfig(Object codec, Consumer<DefaultCodecConfig> configConsumer);

/**
* Add a custom {@code Decoder} internally wrapped with
* {@link DecoderHttpMessageReader}).
* @param decoder the decoder to add
* @deprecated as of 5.1.13, use {@link #register(Object)} or
* {@link #registerWithDefaultConfig(Object)} instead.
*/
@Deprecated
void decoder(Decoder<?> decoder);

/**
* Add a custom {@code Encoder}, internally wrapped with
* {@link EncoderHttpMessageWriter}.
* @param encoder the encoder to add
* @deprecated as of 5.1.13, use {@link #register(Object)} or
* {@link #registerWithDefaultConfig(Object)} instead.
*/
@Deprecated
void encoder(Encoder<?> encoder);

/**
* Add a custom {@link HttpMessageReader}. For readers of type
* {@link DecoderHttpMessageReader} consider using the shortcut
* {@link #decoder(Decoder)} instead.
* @param reader the reader to add
* @deprecated as of 5.1.13, use {@link #register(Object)} or
* {@link #registerWithDefaultConfig(Object)} instead.
*/
@Deprecated
void reader(HttpMessageReader<?> reader);

/**
* Add a custom {@link HttpMessageWriter}. For writers of type
* {@link EncoderHttpMessageWriter} consider using the shortcut
* {@link #encoder(Encoder)} instead.
* @param writer the writer to add
* @deprecated as of 5.1.13, use {@link #register(Object)} or
* {@link #registerWithDefaultConfig(Object)} instead.
*/
@Deprecated
void writer(HttpMessageWriter<?> writer);

/**
* Register a callback for the {@link DefaultCodecConfig configuration}
* applied to default codecs. This allows custom codecs to follow general
* guidelines applied to default ones, such as logging details and limiting
* the amount of buffered data.
* @param codecsConfigConsumer the default codecs configuration callback
* @deprecated as of 5.1.13, use {@link #registerWithDefaultConfig(Object)}
* or {@link #registerWithDefaultConfig(Object, Consumer)} instead.
*/
@Deprecated
void withDefaultCodecConfig(Consumer<DefaultCodecConfig> codecsConfigConsumer);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -166,36 +166,6 @@ public void registerWithDefaultConfig(Object codec, Consumer<DefaultCodecConfig>
this.defaultConfigConsumers.add(configConsumer);
}

@SuppressWarnings("deprecation")
@Override
public void decoder(Decoder<?> decoder) {
addCodec(decoder, false);
}

@SuppressWarnings("deprecation")
@Override
public void encoder(Encoder<?> encoder) {
addCodec(encoder, false);
}

@SuppressWarnings("deprecation")
@Override
public void reader(HttpMessageReader<?> reader) {
addCodec(reader, false);
}

@SuppressWarnings("deprecation")
@Override
public void writer(HttpMessageWriter<?> writer) {
addCodec(writer, false);
}

@SuppressWarnings("deprecation")
@Override
public void withDefaultCodecConfig(Consumer<DefaultCodecConfig> codecsConfigConsumer) {
this.defaultConfigConsumers.add(codecsConfigConsumer);
}

private void addCodec(Object codec, boolean applyDefaultConfig) {

if (codec instanceof Decoder<?> decoder) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -35,29 +35,6 @@ public class HttpMessageNotReadableException extends HttpMessageConversionExcept
private final @Nullable HttpInputMessage httpInputMessage;


/**
* Create a new HttpMessageNotReadableException.
* @param msg the detail message
* @deprecated as of 5.1, in favor of {@link #HttpMessageNotReadableException(String, HttpInputMessage)}
*/
@Deprecated
public HttpMessageNotReadableException(String msg) {
super(msg);
this.httpInputMessage = null;
}

/**
* Create a new HttpMessageNotReadableException.
* @param msg the detail message
* @param cause the root cause (if any)
* @deprecated as of 5.1, in favor of {@link #HttpMessageNotReadableException(String, Throwable, HttpInputMessage)}
*/
@Deprecated
public HttpMessageNotReadableException(String msg, @Nullable Throwable cause) {
super(msg, cause);
this.httpInputMessage = null;
}

/**
* Create a new HttpMessageNotReadableException.
* @param msg the detail message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -248,18 +248,6 @@ protected void dataReceived(T data) {
*/
protected abstract boolean write(T data) throws IOException;

/**
* Invoked after the current data has been written and before requesting
* the next item from the upstream, write Publisher.
* <p>The default implementation is a no-op.
* @deprecated originally introduced for Undertow to stop write notifications
* when no data is available, but deprecated as of 5.0.6 since constant
* switching on every requested item causes a significant slowdown.
*/
@Deprecated
protected void writingPaused() {
}

/**
* Invoked after onComplete or onError notification.
* <p>The default implementation is a no-op.
Expand Down Expand Up @@ -409,7 +397,6 @@ else if (processor.changeState(this, WRITING)) {
processor.changeStateToReceived(REQUESTED);
}
else {
processor.writingPaused();
Assert.state(processor.subscription != null, "No subscription");
processor.subscription.request(1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -72,21 +72,6 @@ public abstract class AbstractServerHttpRequest implements ServerHttpRequest {
private @Nullable Supplier<Map<String, Object>> attributesSupplier;


/**
* Constructor with the method, URI and headers for the request.
* @param method the HTTP method for the request
* @param uri the URI for the request
* @param contextPath the context path for the request
* @param headers the headers for the request (as {@link MultiValueMap})
* @since 6.0.8
* @deprecated Use {@link #AbstractServerHttpRequest(HttpMethod, URI, String, HttpHeaders)}
*/
@Deprecated
public AbstractServerHttpRequest(HttpMethod method, URI uri, @Nullable String contextPath,
MultiValueMap<String, String> headers) {
this(method, uri, contextPath, new HttpHeaders(headers));
}

/**
* Constructor with the method, URI and headers for the request.
* @param method the HTTP method for the request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -97,25 +97,6 @@ protected boolean hasError(HttpStatusCode statusCode) {
return statusCode.isError();
}

/**
* Template method called from {@link #hasError(ClientHttpResponse)}.
* <p>The default implementation checks if the given status code is
* {@link org.springframework.http.HttpStatus.Series#CLIENT_ERROR CLIENT_ERROR} or
* {@link org.springframework.http.HttpStatus.Series#SERVER_ERROR SERVER_ERROR}.
* Can be overridden in subclasses.
* @param statusCode the HTTP status code as raw value
* @return {@code true} if the response indicates an error; {@code false} otherwise
* @since 4.3.21
* @see org.springframework.http.HttpStatus.Series#CLIENT_ERROR
* @see org.springframework.http.HttpStatus.Series#SERVER_ERROR
* @deprecated in favor of {@link #hasError(HttpStatusCode)}
*/
@Deprecated
protected boolean hasError(int statusCode) {
HttpStatus.Series series = HttpStatus.Series.resolve(statusCode);
return (series == HttpStatus.Series.CLIENT_ERROR || series == HttpStatus.Series.SERVER_ERROR);
}

/**
* Handle the error in the given response with the given resolved status code
* and extra information providing access to the request URL and HTTP method.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -823,24 +823,6 @@ else if (ext.getVarsMap() != null) {
return doExecute(url, null, method, requestCallback, responseExtractor);
}

/**
* Execute the given method on the provided URI.
* <p>The {@link ClientHttpRequest} is processed using the {@link RequestCallback};
* the response with the {@link ResponseExtractor}.
* @param url the fully-expanded URL to connect to
* @param method the HTTP method to execute (GET, POST, etc.)
* @param requestCallback object that prepares the request (can be {@code null})
* @param responseExtractor object that extracts the return value from the response (can be {@code null})
* @return an arbitrary object, as returned by the {@link ResponseExtractor}
* @deprecated in favor of {@link #doExecute(URI, String, HttpMethod, RequestCallback, ResponseExtractor)}
*/
@Deprecated
protected <T> @Nullable T doExecute(URI url, @Nullable HttpMethod method, @Nullable RequestCallback requestCallback,
@Nullable ResponseExtractor<T> responseExtractor) throws RestClientException {

return doExecute(url, null, method, requestCallback, responseExtractor);
}

/**
* Execute the given method on the provided URI.
* <p>The {@link ClientHttpRequest} is processed using the {@link RequestCallback};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 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.
Expand Down Expand Up @@ -62,8 +62,6 @@ public class UrlBasedCorsConfigurationSource implements CorsConfigurationSource

private PathMatcher pathMatcher = defaultPathMatcher;

private @Nullable String lookupPathAttributeName;

private boolean allowInitLookupPath = true;

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

/**
* Configure the name of the attribute that holds the lookupPath extracted
* via {@link UrlPathHelper#getLookupPathForRequest(HttpServletRequest)}.
* <p>By default this is {@link UrlPathHelper#PATH_ATTRIBUTE}.
* @param name the request attribute to check
* @since 5.2
* @deprecated as of 5.3 in favor of {@link UrlPathHelper#PATH_ATTRIBUTE}.
*/
@Deprecated
public void setLookupPathAttributeName(String name) {
this.lookupPathAttributeName = name;
}

/**
* Configure a {@code PathMatcher} to use for pattern matching.
* <p>This is an advanced property that should be used only when a
Expand Down Expand Up @@ -262,12 +247,9 @@ public Map<String, CorsConfiguration> getCorsConfigurations() {
return null;
}

@SuppressWarnings("deprecation")
private Object resolvePath(HttpServletRequest request) {
if (this.allowInitLookupPath && !ServletRequestPathUtils.hasCachedPath(request)) {
return (this.lookupPathAttributeName != null ?
this.urlPathHelper.getLookupPathForRequest(request, this.lookupPathAttributeName) :
this.urlPathHelper.getLookupPathForRequest(request));
return this.urlPathHelper.getLookupPathForRequest(request);
}
Object lookupPath = ServletRequestPathUtils.getCachedPath(request);
if (this.pathMatcher != defaultPathMatcher) {
Expand Down
Loading

0 comments on commit 4920086

Please sign in to comment.