DATAES-646 - Adapt to Spring Framework 5.2 RC2.

Un-implement ClientResponse from RawActionResponse to not require us updating the code whenever ClientResponse introduces new methods. Retain only methods from ClientResponse that are actually used.

Consistent versions actross netty dependencies.
This commit is contained in:
Mark Paluch 2019-09-04 12:13:01 +02:00
parent aae7734bc0
commit bdee49f815

View File

@ -15,32 +15,22 @@
*/
package org.springframework.data.elasticsearch.client.reactive;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
import java.util.List;
import org.elasticsearch.action.ActionResponse;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseCookie;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.reactive.ClientHttpResponse;
import org.springframework.util.MultiValueMap;
import org.springframework.web.reactive.function.BodyExtractor;
import org.springframework.web.reactive.function.client.ClientResponse;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import org.springframework.web.reactive.function.client.WebClientResponseException;
/**
* Extension to {@link ActionResponse} that also implements {@link ClientResponse}.
* Extension to {@link ActionResponse} that also delegates to {@link ClientResponse}.
*
* @author Christoph Strobl
* @author Peter-Josef Meisch
* @author Mark Paluch
* @since 3.2
*/
class RawActionResponse extends ActionResponse implements ClientResponse {
class RawActionResponse extends ActionResponse {
private final ClientResponse delegate;
@ -52,157 +42,23 @@ class RawActionResponse extends ActionResponse implements ClientResponse {
return new RawActionResponse(response);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#statusCode()
*/
@Override
public HttpStatus statusCode() {
return delegate.statusCode();
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#rawStatusCode()
*/
@Override
public int rawStatusCode() {
return delegate.rawStatusCode();
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#headers()
*/
@Override
public Headers headers() {
public ClientResponse.Headers headers() {
return delegate.headers();
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#cookies()
*/
@Override
public MultiValueMap<String, ResponseCookie> cookies() {
return delegate.cookies();
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#strategies()
*/
@Override
public ExchangeStrategies strategies() {
return delegate.strategies();
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#body(org.springframework.web.reactive.function.BodyExtractor)
*/
@Override
public <T> T body(BodyExtractor<T, ? super ClientHttpResponse> extractor) {
return delegate.body(extractor);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#bodyToMono(java.lang.Class)
*/
@Override
public <T> Mono<T> bodyToMono(Class<? extends T> elementClass) {
return delegate.bodyToMono(elementClass);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#bodyToMono(org.springframework.core.ParameterizedTypeReference)
*/
@Override
public <T> Mono<T> bodyToMono(ParameterizedTypeReference<T> typeReference) {
return delegate.bodyToMono(typeReference);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#bodyToFlux(java.lang.Class)
*/
@Override
public <T> Flux<T> bodyToFlux(Class<? extends T> elementClass) {
return delegate.bodyToFlux(elementClass);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#bodyToFlux(org.springframework.core.ParameterizedTypeReference)
*/
@Override
public <T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> typeReference) {
return delegate.bodyToFlux(typeReference);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#releaseBody()
*/
@Override
public Mono<Void> releaseBody() {
return delegate.releaseBody();
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#toEntity(java.lang.Class)
*/
@Override
public <T> Mono<ResponseEntity<T>> toEntity(Class<T> bodyType) {
return delegate.toEntity(bodyType);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#toEntity(org.springframework.core.ParameterizedTypeReference)
*/
@Override
public <T> Mono<ResponseEntity<T>> toEntity(ParameterizedTypeReference<T> typeReference) {
return delegate.toEntity(typeReference);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#toEntityList(java.lang.Class)
*/
@Override
public <T> Mono<ResponseEntity<List<T>>> toEntityList(Class<T> elementType) {
return delegate.toEntityList(elementType);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#toBodilessEntity()
*/
@Override
public Mono<ResponseEntity<Void>> toBodilessEntity() {
return delegate.toBodilessEntity();
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#toEntityList(org.springframework.core.ParameterizedTypeReference)
*/
@Override
public <T> Mono<ResponseEntity<List<T>>> toEntityList(ParameterizedTypeReference<T> typeReference) {
return delegate.toEntityList(typeReference);
}
/*
* (non-Javadoc)
* @see org.springframework.web.reactive.function.client.ClientResponse#createException()
*/
@Override
public Mono<WebClientResponseException> createException() {
return delegate.createException();
}
}