Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
@@ -70,6 +70,8 @@ import org.springframework.util.ObjectUtils;
|
||||
* @param <T> the body type
|
||||
* @see #getMethod()
|
||||
* @see #getUrl()
|
||||
* @see org.springframework.web.client.RestOperations#exchange(RequestEntity, Class)
|
||||
* @see ResponseEntity
|
||||
*/
|
||||
public class RequestEntity<T> extends HttpEntity<T> {
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ import org.springframework.util.ObjectUtils;
|
||||
* @since 3.0.2
|
||||
* @param <T> the body type
|
||||
* @see #getStatusCode()
|
||||
* @see org.springframework.web.client.RestOperations#getForEntity(String, Class, Object...)
|
||||
* @see org.springframework.web.client.RestOperations#getForEntity(String, Class, java.util.Map)
|
||||
* @see org.springframework.web.client.RestOperations#getForEntity(URI, Class)
|
||||
* @see RequestEntity
|
||||
*/
|
||||
public class ResponseEntity<T> extends HttpEntity<T> {
|
||||
|
||||
|
||||
@@ -417,26 +417,23 @@ class DefaultWebClient implements WebClient {
|
||||
|
||||
private static class DefaultResponseSpec implements ResponseSpec {
|
||||
|
||||
private static final IntPredicate STATUS_CODE_ERROR = value -> value >= 400;
|
||||
private static final IntPredicate STATUS_CODE_ERROR = (value -> value >= 400);
|
||||
|
||||
private static final StatusHandler DEFAULT_STATUS_HANDLER =
|
||||
new StatusHandler(STATUS_CODE_ERROR, ClientResponse::createException);
|
||||
|
||||
|
||||
private final Mono<ClientResponse> responseMono;
|
||||
|
||||
private final Supplier<HttpRequest> requestSupplier;
|
||||
|
||||
private final List<StatusHandler> statusHandlers = new ArrayList<>(1);
|
||||
|
||||
|
||||
DefaultResponseSpec(Mono<ClientResponse> responseMono, Supplier<HttpRequest> requestSupplier) {
|
||||
this.responseMono = responseMono;
|
||||
this.requestSupplier = requestSupplier;
|
||||
this.statusHandlers.add(DEFAULT_STATUS_HANDLER);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseSpec onStatus(Predicate<HttpStatus> statusPredicate,
|
||||
Function<ClientResponse, Mono<? extends Throwable>> exceptionFunction) {
|
||||
|
||||
@@ -101,6 +101,7 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
|
||||
this.defaultUriVariables = (other.defaultUriVariables != null ?
|
||||
new LinkedHashMap<>(other.defaultUriVariables) : null);
|
||||
this.uriBuilderFactory = other.uriBuilderFactory;
|
||||
|
||||
if (other.defaultHeaders != null) {
|
||||
this.defaultHeaders = new HttpHeaders();
|
||||
this.defaultHeaders.putAll(other.defaultHeaders);
|
||||
@@ -108,13 +109,16 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
|
||||
else {
|
||||
this.defaultHeaders = null;
|
||||
}
|
||||
|
||||
this.defaultCookies = (other.defaultCookies != null ?
|
||||
new LinkedMultiValueMap<>(other.defaultCookies) : null);
|
||||
this.defaultRequest = other.defaultRequest;
|
||||
this.filters = other.filters != null ? new ArrayList<>(other.filters) : null;
|
||||
this.filters = (other.filters != null ? new ArrayList<>(other.filters) : null);
|
||||
|
||||
this.connector = other.connector;
|
||||
this.strategies = other.strategies;
|
||||
this.strategiesConfigurers = other.strategiesConfigurers != null ? new ArrayList<>(other.strategiesConfigurers) : null;
|
||||
this.strategiesConfigurers = (other.strategiesConfigurers != null ?
|
||||
new ArrayList<>(other.strategiesConfigurers) : null);
|
||||
this.exchangeFunction = other.exchangeFunction;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user