This commit is contained in:
Andy Wilkinson
2022-10-25 12:25:03 +01:00
parent b014039a34
commit 99edda735e
42 changed files with 125 additions and 149 deletions

View File

@@ -239,21 +239,16 @@ public class JerseyEndpointResourceFactory {
Status status = isGet ? Status.NOT_FOUND : Status.NO_CONTENT;
return Response.status(status).build();
}
try {
if (!(response instanceof WebEndpointResponse)) {
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
}
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
return Response.status(webEndpointResponse.getStatus())
.header("Content-Type", webEndpointResponse.getContentType())
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
}
catch (IOException ex) {
return Response.status(Status.INTERNAL_SERVER_ERROR).build();
if (!(response instanceof WebEndpointResponse)) {
return Response.status(Status.OK).entity(convertIfNecessary(response)).build();
}
WebEndpointResponse<?> webEndpointResponse = (WebEndpointResponse<?>) response;
return Response.status(webEndpointResponse.getStatus())
.header("Content-Type", webEndpointResponse.getContentType())
.entity(convertIfNecessary(webEndpointResponse.getBody())).build();
}
private Object convertIfNecessary(Object body) throws IOException {
private Object convertIfNecessary(Object body) {
for (Function<Object, Object> converter : BODY_CONVERTERS) {
body = converter.apply(body);
}

View File

@@ -140,7 +140,6 @@ public abstract class AbstractWebMvcEndpointHandlerMapping extends RequestMappin
}
@Override
@SuppressWarnings("deprecation")
public void afterPropertiesSet() {
this.builderConfig = new RequestMappingInfo.BuilderConfiguration();
this.builderConfig.setPatternParser(getPatternParser());

View File

@@ -58,7 +58,6 @@ public class ControllerEndpointHandlerMapping extends RequestMappingHandlerMappi
* @param endpoints the web endpoints
* @param corsConfiguration the CORS configuration for the endpoints or {@code null}
*/
@SuppressWarnings("deprecation")
public ControllerEndpointHandlerMapping(EndpointMapping endpointMapping,
Collection<ExposableControllerEndpoint> endpoints, CorsConfiguration corsConfiguration) {
Assert.notNull(endpointMapping, "EndpointMapping must not be null");

View File

@@ -34,7 +34,7 @@ import org.springframework.util.StringUtils;
* {@link org.springframework.http.client.observation.DefaultClientRequestObservationConvention}
*/
@Deprecated(since = "3.0.0", forRemoval = true)
@SuppressWarnings({ "deprecation", "removal" })
@SuppressWarnings("removal")
public class DefaultRestTemplateExchangeTagsProvider implements RestTemplateExchangeTagsProvider {
@Override

View File

@@ -33,7 +33,7 @@ import org.springframework.web.reactive.function.client.ClientResponse;
* {@link org.springframework.web.reactive.function.client.ClientRequestObservationConvention}
*/
@Deprecated(since = "3.0.0", forRemoval = true)
@SuppressWarnings({ "deprecation", "removal" })
@SuppressWarnings("removal")
public class DefaultWebClientExchangeTagsProvider implements WebClientExchangeTagsProvider {
@Override

View File

@@ -41,6 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.0.0", forRemoval = true)
class DefaultWebMvcTagsProviderTests {
@Test

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@@ -35,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Michael McFadyen
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.0.0", forRemoval = true)
class WebMvcTagsTests {
private final MockHttpServletRequest request = new MockHttpServletRequest();

View File

@@ -30,7 +30,6 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Brian Clozel
*/
@SuppressWarnings("deprecation")
class ObservationWebClientCustomizerTests {
private static final String TEST_METRIC_NAME = "http.test.metric.name";

View File

@@ -38,6 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.0.0", forRemoval = true)
class DefaultWebFluxTagsProviderTests {
@Test

View File

@@ -45,6 +45,7 @@ import static org.mockito.Mockito.mock;
* @author Stephane Nicoll
*/
@SuppressWarnings("removal")
@Deprecated(since = "3.0.0", forRemoval = true)
class WebFluxTagsTests {
private MockServerWebExchange exchange;