Polishing

This commit is contained in:
Juergen Hoeller
2019-07-30 16:59:01 +02:00
parent 9a36027ae1
commit c4622dbebc
17 changed files with 40 additions and 52 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 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.
@@ -129,13 +129,11 @@ final class DefaultClientResponseBuilder implements ClientResponse.Builder {
@Override
public ClientResponse build() {
ClientHttpResponse httpResponse =
new BuiltClientHttpResponse(this.statusCode, this.headers, this.cookies, this.body);
// When building ClientResponse manually, the ClientRequest.logPrefix() has to be passed,
// e.g. via ClientResponse.Builder, but this (builder) is not used currently.
return new DefaultClientResponse(httpResponse, this.strategies, "");
}

View File

@@ -423,7 +423,7 @@ class DefaultWebClient implements WebClient {
private static IntPredicate toIntPredicate(Predicate<HttpStatus> predicate) {
return value -> {
HttpStatus status = HttpStatus.resolve(value);
return (status != null) && predicate.test(status);
return (status != null && predicate.test(status));
};
}
@@ -436,7 +436,6 @@ class DefaultWebClient implements WebClient {
}
this.statusHandlers.add(new StatusHandler(statusCodePredicate,
(clientResponse, request) -> exceptionFunction.apply(clientResponse)));
return this;
}
@@ -539,8 +538,6 @@ class DefaultWebClient implements WebClient {
public StatusHandler(IntPredicate predicate,
BiFunction<ClientResponse, HttpRequest, Mono<? extends Throwable>> exceptionFunction) {
Assert.notNull(predicate, "Predicate must not be null");
Assert.notNull(exceptionFunction, "Function must not be null");
this.predicate = predicate;
this.exceptionFunction = exceptionFunction;
}
@@ -552,8 +549,6 @@ class DefaultWebClient implements WebClient {
public Mono<? extends Throwable> apply(ClientResponse response, HttpRequest request) {
return this.exceptionFunction.apply(response, request);
}
}
}

View File

@@ -583,6 +583,7 @@ public interface WebClient {
RequestHeadersSpec<?> syncBody(Object body);
}
/**
* Contract for specifying response operations following the exchange.
*/
@@ -666,24 +667,22 @@ public interface WebClient {
* status code is 4xx or 5xx
*/
<T> Flux<T> bodyToFlux(ParameterizedTypeReference<T> typeReference);
}
/**
* Contract for specifying request headers and URI for a request.
*
* @param <S> a self reference to the spec type
*/
interface RequestHeadersUriSpec<S extends RequestHeadersSpec<S>>
extends UriSpec<S>, RequestHeadersSpec<S> {
}
/**
* Contract for specifying request headers, body and URI for a request.
*/
interface RequestBodyUriSpec extends RequestBodySpec, RequestHeadersUriSpec<RequestBodySpec> {
}
}