Merge branch '6.1.x'

This commit is contained in:
rstoyanchev
2024-08-28 18:59:47 +03:00
27 changed files with 79 additions and 31 deletions

View File

@@ -42,6 +42,19 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
*/
HttpStatusCode getStatusCode() throws IOException;
/**
* Get the HTTP status code as an integer.
* @return the HTTP status as an integer value
* @throws IOException in case of I/O errors
* @since 3.1.1
* @see #getStatusCode()
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
*/
@Deprecated(since = "6.0", forRemoval = true)
default int getRawStatusCode() throws IOException {
return getStatusCode().value();
}
/**
* Get the HTTP status text of the response.
* @return the HTTP status text

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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,6 +46,18 @@ 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 in favor of {@link #getStatusCode()}, for removal in 7.0
*/
@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-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -115,13 +115,6 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
return setStatusCode(statusCode != null ? HttpStatusCode.valueOf(statusCode) : null);
}
@Deprecated
@Override
@Nullable
public Integer getRawStatusCode() {
return (this.statusCode != null ? this.statusCode.value() : null);
}
@Override
public HttpHeaders getHeaders() {
if (this.readOnlyHeaders != null) {

View File

@@ -78,6 +78,7 @@ class ReactorNetty2ServerHttpResponse extends AbstractServerHttpResponse impleme
@Override
@Deprecated
@SuppressWarnings("removal")
public Integer getRawStatusCode() {
Integer status = super.getRawStatusCode();
return (status != null ? status : this.response.status().code());

View File

@@ -77,6 +77,7 @@ class ReactorServerHttpResponse extends AbstractServerHttpResponse implements Ze
@Override
@Deprecated
@SuppressWarnings("removal")
public Integer getRawStatusCode() {
Integer status = super.getRawStatusCode();
return (status != null ? status : this.response.status().code());

View File

@@ -65,9 +65,9 @@ public interface ServerHttpResponse extends ReactiveHttpOutputMessage {
* status of the response from the underlying server. The return value may
* be {@code null} if there is no default value from the underlying server.
* @since 5.2.4
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
*/
@Deprecated(since = "6.0")
@Deprecated(since = "6.0", forRemoval = true)
@Nullable
default Integer getRawStatusCode() {
HttpStatusCode httpStatus = getStatusCode();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 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.
@@ -74,6 +74,7 @@ public class ServerHttpResponseDecorator implements ServerHttpResponse {
@Override
@Nullable
@Deprecated
@SuppressWarnings("removal")
public Integer getRawStatusCode() {
return getDelegate().getRawStatusCode();
}

View File

@@ -112,6 +112,7 @@ class ServletServerHttpResponse extends AbstractListenerServerHttpResponse {
@Override
@Deprecated
@SuppressWarnings("removal")
public Integer getRawStatusCode() {
Integer status = super.getRawStatusCode();
return (status != null ? status : this.response.getStatus());

View File

@@ -89,6 +89,7 @@ class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse impl
@Override
@Deprecated
@SuppressWarnings("removal")
public Integer getRawStatusCode() {
Integer status = super.getRawStatusCode();
return (status != null ? status : this.exchange.getStatusCode());

View File

@@ -125,7 +125,7 @@ public class RestClientResponseException extends RestClientException {
/**
* Return the raw HTTP status code value.
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
*/
@Deprecated(since = "6.0")
public int getRawStatusCode() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 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.
@@ -113,7 +113,7 @@ public class UnknownContentTypeException extends RestClientException {
/**
* Return the raw HTTP status code value.
* @deprecated as of 6.0, in favor of {@link #getStatusCode()}
* @deprecated in favor of {@link #getStatusCode()}, for removal in 7.0
*/
@Deprecated(since = "6.0")
public int getRawStatusCode() {

View File

@@ -132,9 +132,9 @@ public class ResponseStatusExceptionHandler implements WebExceptionHandler {
* @param ex the exception to check
* @return the associated HTTP status code, or -1 if it can't be derived.
* @since 5.3
* @deprecated as of 6.0, in favor of {@link #determineStatus(Throwable)}
* @deprecated in favor of {@link #determineStatus(Throwable)}, for removal in 7.0
*/
@Deprecated(since = "6.0")
@Deprecated(since = "6.0", forRemoval = true)
protected int determineRawStatusCode(Throwable ex) {
if (ex instanceof ResponseStatusException responseStatusException) {
return responseStatusException.getStatusCode().value();