Adapt to changes in Spring Framework 6.0 HttpStatus.

Fixes #2134.
This commit is contained in:
Oliver Drotbohm 2022-04-11 17:00:59 +02:00
parent a60f3059e1
commit 48e2e9dea7
No known key found for this signature in database
GPG Key ID: C25FBFA0DA493A1D
2 changed files with 7 additions and 4 deletions

View File

@ -20,6 +20,7 @@ import java.util.function.Supplier;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -30,6 +31,7 @@ import org.springframework.util.ObjectUtils;
* @author Mark Paluch * @author Mark Paluch
* @author Christoph Strobl * @author Christoph Strobl
* @author Peter-Josef Meisch * @author Peter-Josef Meisch
* @author Oliver Drotbohm
* @since 3.2 * @since 3.2
*/ */
public abstract class ClientLogger { public abstract class ClientLogger {
@ -125,7 +127,7 @@ public abstract class ClientLogger {
* @param logId the correlation id, see {@link #newLogId()}. * @param logId the correlation id, see {@link #newLogId()}.
* @param statusCode the HTTP status code. * @param statusCode the HTTP status code.
*/ */
public static void logRawResponse(String logId, @Nullable HttpStatus statusCode) { public static void logRawResponse(String logId, @Nullable HttpStatusCode statusCode) {
if (isEnabled()) { if (isEnabled()) {
WIRE_LOGGER.trace(String.format("[%s] Received raw response: %s", logId, statusCode)); WIRE_LOGGER.trace(String.format("[%s] Received raw response: %s", logId, statusCode));
@ -153,7 +155,7 @@ public abstract class ClientLogger {
* @param statusCode the HTTP status code. * @param statusCode the HTTP status code.
* @param body body content. * @param body body content.
*/ */
public static void logResponse(String logId, HttpStatus statusCode, String body) { public static void logResponse(String logId, HttpStatusCode statusCode, String body) {
if (isEnabled()) { if (isEnabled()) {
WIRE_LOGGER.trace(String.format("[%s] Received response: %s%nResponse body: %s", logId, statusCode, body)); WIRE_LOGGER.trace(String.format("[%s] Received response: %s%nResponse body: %s", logId, statusCode, body));

View File

@ -21,7 +21,7 @@ import java.io.IOException;
import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatusCode;
import org.springframework.http.client.reactive.ClientHttpResponse; import org.springframework.http.client.reactive.ClientHttpResponse;
import org.springframework.web.reactive.function.BodyExtractor; import org.springframework.web.reactive.function.BodyExtractor;
import org.springframework.web.reactive.function.client.ClientResponse; import org.springframework.web.reactive.function.client.ClientResponse;
@ -32,6 +32,7 @@ import org.springframework.web.reactive.function.client.ClientResponse;
* @author Christoph Strobl * @author Christoph Strobl
* @author Peter-Josef Meisch * @author Peter-Josef Meisch
* @author Mark Paluch * @author Mark Paluch
* @author Oliver Drotbohm
* @since 3.2 * @since 3.2
*/ */
class RawActionResponse extends ActionResponse { class RawActionResponse extends ActionResponse {
@ -46,7 +47,7 @@ class RawActionResponse extends ActionResponse {
return new RawActionResponse(response); return new RawActionResponse(response);
} }
public HttpStatus statusCode() { public HttpStatusCode statusCode() {
return delegate.statusCode(); return delegate.statusCode();
} }