Skip to content

Commit 7aa25e0

Browse files
committed
Merge branch '6.1.x'
2 parents 5bcfcdd + 186deb7 commit 7aa25e0

27 files changed

+79
-31
lines changed

spring-test/src/main/java/org/springframework/test/web/reactive/server/ExchangeResult.java

Lines changed: 11 additions & 1 deletion
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-2024 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.
@@ -176,6 +176,16 @@ public HttpStatusCode getStatus() {
176176
return this.response.getStatusCode();
177177
}
178178

179+
/**
180+
* Return the HTTP status code as an integer.
181+
* @since 5.1.10
182+
* @deprecated in favor of {@link #getStatus()}, for removal in 7.0
183+
*/
184+
@Deprecated(since = "6.0", forRemoval = true)
185+
public int getRawStatusCode() {
186+
return getStatus().value();
187+
}
188+
179189
/**
180190
* Return the response headers received from the server.
181191
*/

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
4242
*/
4343
HttpStatusCode getStatusCode() throws IOException;
4444

45+
/**
46+
* Get the HTTP status code as an integer.
47+
* @return the HTTP status as an integer value
48+
* @throws IOException in case of I/O errors
49+
* @since 3.1.1
50+
* @see #getStatusCode()
51+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
52+
*/
53+
@Deprecated(since = "6.0", forRemoval = true)
54+
default int getRawStatusCode() throws IOException {
55+
return getStatusCode().value();
56+
}
57+
4558
/**
4659
* Get the HTTP status text of the response.
4760
* @return the HTTP status text

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

Lines changed: 13 additions & 1 deletion
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-2024 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.
@@ -46,6 +46,18 @@ default String getId() {
4646
*/
4747
HttpStatusCode getStatusCode();
4848

49+
/**
50+
* Return the HTTP status code as an integer.
51+
* @return the HTTP status as an integer value
52+
* @since 5.0.6
53+
* @see #getStatusCode()
54+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
55+
*/
56+
@Deprecated(since = "6.0", forRemoval = true)
57+
default int getRawStatusCode() {
58+
return getStatusCode().value();
59+
}
60+
4961
/**
5062
* Return a read-only map of response cookies received from the server.
5163
*/

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

Lines changed: 1 addition & 8 deletions
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-2024 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.
@@ -115,13 +115,6 @@ public boolean setRawStatusCode(@Nullable Integer statusCode) {
115115
return setStatusCode(statusCode != null ? HttpStatusCode.valueOf(statusCode) : null);
116116
}
117117

118-
@Deprecated
119-
@Override
120-
@Nullable
121-
public Integer getRawStatusCode() {
122-
return (this.statusCode != null ? this.statusCode.value() : null);
123-
}
124-
125118
@Override
126119
public HttpHeaders getHeaders() {
127120
if (this.readOnlyHeaders != null) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public HttpStatusCode getStatusCode() {
7878

7979
@Override
8080
@Deprecated
81+
@SuppressWarnings("removal")
8182
public Integer getRawStatusCode() {
8283
Integer status = super.getRawStatusCode();
8384
return (status != null ? status : this.response.status().code());

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public HttpStatusCode getStatusCode() {
7777

7878
@Override
7979
@Deprecated
80+
@SuppressWarnings("removal")
8081
public Integer getRawStatusCode() {
8182
Integer status = super.getRawStatusCode();
8283
return (status != null ? status : this.response.status().code());

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ default boolean setRawStatusCode(@Nullable Integer value) {
6565
* status of the response from the underlying server. The return value may
6666
* be {@code null} if there is no default value from the underlying server.
6767
* @since 5.2.4
68-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
68+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
6969
*/
70-
@Deprecated(since = "6.0")
70+
@Deprecated(since = "6.0", forRemoval = true)
7171
@Nullable
7272
default Integer getRawStatusCode() {
7373
HttpStatusCode httpStatus = getStatusCode();

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

Lines changed: 2 additions & 1 deletion
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-2024 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.
@@ -74,6 +74,7 @@ public boolean setRawStatusCode(@Nullable Integer value) {
7474
@Override
7575
@Nullable
7676
@Deprecated
77+
@SuppressWarnings("removal")
7778
public Integer getRawStatusCode() {
7879
return getDelegate().getRawStatusCode();
7980
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public HttpStatusCode getStatusCode() {
112112

113113
@Override
114114
@Deprecated
115+
@SuppressWarnings("removal")
115116
public Integer getRawStatusCode() {
116117
Integer status = super.getRawStatusCode();
117118
return (status != null ? status : this.response.getStatus());

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public HttpStatusCode getStatusCode() {
8989

9090
@Override
9191
@Deprecated
92+
@SuppressWarnings("removal")
9293
public Integer getRawStatusCode() {
9394
Integer status = super.getRawStatusCode();
9495
return (status != null ? status : this.exchange.getStatusCode());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public HttpStatusCode getStatusCode() {
125125

126126
/**
127127
* Return the raw HTTP status code value.
128-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
128+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
129129
*/
130130
@Deprecated(since = "6.0")
131131
public int getRawStatusCode() {

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

Lines changed: 2 additions & 2 deletions
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-2024 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.
@@ -113,7 +113,7 @@ public HttpStatusCode getStatusCode() {
113113

114114
/**
115115
* Return the raw HTTP status code value.
116-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
116+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
117117
*/
118118
@Deprecated(since = "6.0")
119119
public int getRawStatusCode() {

spring-web/src/main/java/org/springframework/web/server/handler/ResponseStatusExceptionHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ protected HttpStatusCode determineStatus(Throwable ex) {
132132
* @param ex the exception to check
133133
* @return the associated HTTP status code, or -1 if it can't be derived.
134134
* @since 5.3
135-
* @deprecated as of 6.0, in favor of {@link #determineStatus(Throwable)}
135+
* @deprecated in favor of {@link #determineStatus(Throwable)}, for removal in 7.0
136136
*/
137-
@Deprecated(since = "6.0")
137+
@Deprecated(since = "6.0", forRemoval = true)
138138
protected int determineRawStatusCode(Throwable ex) {
139139
if (ex instanceof ResponseStatusException responseStatusException) {
140140
return responseStatusException.getStatusCode().value();

spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ClientResponse.java

Lines changed: 12 additions & 1 deletion
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-2024 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.
@@ -57,6 +57,17 @@ public interface ClientResponse {
5757
*/
5858
HttpStatusCode statusCode();
5959

60+
/**
61+
* Return the raw status code of this response.
62+
* @return the HTTP status as an integer value
63+
* @since 5.1
64+
* @deprecated in favor of {@link #statusCode()}, for removal in 7.0
65+
*/
66+
@Deprecated(since = "6.0", forRemoval = true)
67+
default int rawStatusCode() {
68+
return statusCode().value();
69+
}
70+
6071
/**
6172
* Return the headers of this response.
6273
*/

spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ interface ResponseSpec {
824824
* .retrieve()
825825
* .bodyToMono(Account.class)
826826
* .onErrorResume(WebClientResponseException.class,
827-
* ex -> ex.getRawStatusCode() == 404 ? Mono.empty() : Mono.error(ex));
827+
* ex -> ex.getStatusCode().value() == 404 ? Mono.empty() : Mono.error(ex));
828828
* </pre>
829829
* @param statusPredicate to match responses with
830830
* @param exceptionFunction to map the response to an error signal

spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClientResponseException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public HttpStatusCode getStatusCode() {
172172

173173
/**
174174
* Return the raw HTTP status code value.
175-
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
175+
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
176176
*/
177177
@Deprecated(since = "6.0")
178178
public int getRawStatusCode() {

spring-webflux/src/main/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ public final HttpStatusCode statusCode() {
328328

329329
@Override
330330
@Deprecated
331+
@SuppressWarnings("removal")
331332
public int rawStatusCode() {
332333
return this.statusCode.value();
333334
}

spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public interface ServerResponse {
7070
* Return the status code of this response as integer.
7171
* @return the status as an integer
7272
* @since 5.2
73-
* @deprecated as of 6.0, in favor of {@link #statusCode()}
73+
* @deprecated in favor of {@link #statusCode()}, for removal in 7.0
7474
*/
75-
@Deprecated(since = "6.0")
75+
@Deprecated(since = "6.0", forRemoval = true)
7676
int rawStatusCode();
7777

7878
/**

spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultEntityResponseBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void fromProducer() {
8484
}
8585

8686
@Test
87-
@SuppressWarnings("deprecation")
87+
@SuppressWarnings("removal")
8888
void status() {
8989
String body = "foo";
9090
Mono<EntityResponse<String>> result = EntityResponse.fromObject(body).status(HttpStatus.CREATED).build();

spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultServerResponseBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void from() {
8080
}
8181

8282
@Test
83-
@SuppressWarnings("deprecation")
83+
@SuppressWarnings("removal")
8484
void status() {
8585
Mono<ServerResponse> result = ServerResponse.status(HttpStatus.CREATED).build();
8686
StepVerifier.create(result)

spring-webflux/src/test/java/org/springframework/web/reactive/function/server/RouterFunctionsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void toHttpHandlerHandlerReturnResponseStatusExceptionInResponseWriteTo() {
223223
public HttpStatus statusCode() {
224224
return HttpStatus.OK;
225225
}
226-
@SuppressWarnings("deprecation")
226+
@SuppressWarnings("removal")
227227
@Override
228228
public int rawStatusCode() {
229229
return 200;
@@ -262,7 +262,7 @@ void toHttpHandlerHandlerThrowResponseStatusExceptionInResponseWriteTo() {
262262
public HttpStatus statusCode() {
263263
return HttpStatus.OK;
264264
}
265-
@SuppressWarnings("deprecation")
265+
@SuppressWarnings("removal")
266266
@Override
267267
public int rawStatusCode() {
268268
return 200;

spring-webmvc/src/main/java/org/springframework/web/servlet/function/AbstractServerResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public final HttpStatusCode statusCode() {
6767

6868
@Override
6969
@Deprecated
70+
@SuppressWarnings("removal")
7071
public int rawStatusCode() {
7172
return this.statusCode.value();
7273
}

spring-webmvc/src/main/java/org/springframework/web/servlet/function/CompletedAsyncServerResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public HttpStatusCode statusCode() {
5858

5959
@Override
6060
@Deprecated
61+
@SuppressWarnings("removal")
6162
public int rawStatusCode() {
6263
return this.serverResponse.rawStatusCode();
6364
}

spring-webmvc/src/main/java/org/springframework/web/servlet/function/DefaultAsyncServerResponse.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public HttpStatusCode statusCode() {
8585

8686
@Override
8787
@Deprecated
88+
@SuppressWarnings("removal")
8889
public int rawStatusCode() {
8990
return delegate(ServerResponse::rawStatusCode);
9091
}

spring-webmvc/src/main/java/org/springframework/web/servlet/function/ServerResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ public interface ServerResponse {
6868
/**
6969
* Return the status code of this response as integer.
7070
* @return the status as an integer
71-
* @deprecated as of 6.0, in favor of {@link #statusCode()}
71+
* @deprecated in favor of {@link #statusCode()}, for removal in 7.0
7272
*/
73-
@Deprecated(since = "6.0")
73+
@Deprecated(since = "6.0", forRemoval = true)
7474
int rawStatusCode();
7575

7676
/**

spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultEntityResponseBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void fromObjectTypeReference() {
6666
}
6767

6868
@Test
69-
@SuppressWarnings("deprecation")
69+
@SuppressWarnings("removal")
7070
void status() {
7171
String body = "foo";
7272
EntityResponse<String> result =

spring-webmvc/src/test/java/org/springframework/web/servlet/function/DefaultServerResponseBuilderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class DefaultServerResponseBuilderTests {
5555
static final ServerResponse.Context EMPTY_CONTEXT = Collections::emptyList;
5656

5757
@Test
58-
@SuppressWarnings("deprecation")
58+
@SuppressWarnings("removal")
5959
void status() {
6060
ServerResponse response = ServerResponse.status(HttpStatus.CREATED).build();
6161
assertThat(response.statusCode()).isEqualTo(HttpStatus.CREATED);

0 commit comments

Comments
 (0)