Revise how bodyType is set for 7.0 codebase
See gh-34793
This commit is contained in:
parent
fed6e9b3c3
commit
d8503daa1f
|
@ -75,18 +75,19 @@ public class HttpRequestValues {
|
||||||
|
|
||||||
private final @Nullable Object bodyValue;
|
private final @Nullable Object bodyValue;
|
||||||
|
|
||||||
private @Nullable ParameterizedTypeReference<?> bodyValueType;
|
private final @Nullable ParameterizedTypeReference<?> bodyValueType;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct {@link HttpRequestValues}.
|
* Construct {@link HttpRequestValues}.
|
||||||
* @since 6.1
|
* @since 7.0
|
||||||
*/
|
*/
|
||||||
protected HttpRequestValues(@Nullable HttpMethod httpMethod,
|
protected HttpRequestValues(@Nullable HttpMethod httpMethod,
|
||||||
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
|
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
|
||||||
@Nullable String uriTemplate, Map<String, String> uriVariables,
|
@Nullable String uriTemplate, Map<String, String> uriVariables,
|
||||||
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
|
HttpHeaders headers, MultiValueMap<String, String> cookies,
|
||||||
Map<String, Object> attributes, @Nullable Object bodyValue) {
|
@Nullable Object version, Map<String, Object> attributes,
|
||||||
|
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType) {
|
||||||
|
|
||||||
Assert.isTrue(uri != null || uriTemplate != null, "Neither URI nor URI template");
|
Assert.isTrue(uri != null || uriTemplate != null, "Neither URI nor URI template");
|
||||||
|
|
||||||
|
@ -100,6 +101,7 @@ public class HttpRequestValues {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.attributes = attributes;
|
this.attributes = attributes;
|
||||||
this.bodyValue = bodyValue;
|
this.bodyValue = bodyValue;
|
||||||
|
this.bodyValueType = bodyValueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -511,14 +513,9 @@ public class HttpRequestValues {
|
||||||
Map<String, Object> attributes = (this.attributes != null ?
|
Map<String, Object> attributes = (this.attributes != null ?
|
||||||
new HashMap<>(this.attributes) : Collections.emptyMap());
|
new HashMap<>(this.attributes) : Collections.emptyMap());
|
||||||
|
|
||||||
HttpRequestValues requestValues = createRequestValues(
|
return createRequestValues(
|
||||||
this.httpMethod, uri, uriBuilderFactory, uriTemplate, uriVars,
|
this.httpMethod, uri, uriBuilderFactory, uriTemplate, uriVars,
|
||||||
headers, cookies, this.version, attributes, bodyValue);
|
headers, cookies, this.version, attributes, bodyValue, this.bodyValueType);
|
||||||
|
|
||||||
// In 6.2.x only, temporarily work around protected methods
|
|
||||||
requestValues.bodyValueType = this.bodyValueType;
|
|
||||||
|
|
||||||
return requestValues;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasParts() {
|
protected boolean hasParts() {
|
||||||
|
@ -557,18 +554,18 @@ public class HttpRequestValues {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create {@link HttpRequestValues} from values passed to the {@link Builder}.
|
* Create {@link HttpRequestValues} from values passed to the {@link Builder}.
|
||||||
* @since 6.1
|
* @since 7.0
|
||||||
*/
|
*/
|
||||||
protected HttpRequestValues createRequestValues(
|
protected HttpRequestValues createRequestValues(
|
||||||
@Nullable HttpMethod httpMethod,
|
@Nullable HttpMethod httpMethod,
|
||||||
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory, @Nullable String uriTemplate,
|
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory, @Nullable String uriTemplate,
|
||||||
Map<String, String> uriVars,
|
Map<String, String> uriVars, HttpHeaders headers, MultiValueMap<String, String> cookies,
|
||||||
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
|
@Nullable Object version, Map<String, Object> attributes,
|
||||||
Map<String, Object> attributes, @Nullable Object bodyValue) {
|
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType) {
|
||||||
|
|
||||||
return new HttpRequestValues(
|
return new HttpRequestValues(
|
||||||
this.httpMethod, uri, uriBuilderFactory, uriTemplate,
|
this.httpMethod, uri, uriBuilderFactory, uriTemplate,
|
||||||
uriVars, headers, cookies, version, attributes, bodyValue);
|
uriVars, headers, cookies, version, attributes, bodyValue, bodyValueType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,16 @@ public final class ReactiveHttpRequestValues extends HttpRequestValues {
|
||||||
@Nullable HttpMethod httpMethod,
|
@Nullable HttpMethod httpMethod,
|
||||||
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
|
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
|
||||||
@Nullable String uriTemplate, Map<String, String> uriVars,
|
@Nullable String uriTemplate, Map<String, String> uriVars,
|
||||||
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
|
HttpHeaders headers, MultiValueMap<String, String> cookies,
|
||||||
Map<String, Object> attributes,
|
@Nullable Object version, Map<String, Object> attributes,
|
||||||
@Nullable Object bodyValue, @Nullable Publisher<?> body,
|
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType,
|
||||||
@Nullable ParameterizedTypeReference<?> elementType) {
|
@Nullable Publisher<?> body, @Nullable ParameterizedTypeReference<?> elementType) {
|
||||||
|
|
||||||
|
super(httpMethod,
|
||||||
|
uri, uriBuilderFactory, uriTemplate, uriVars,
|
||||||
|
headers, cookies, version, attributes,
|
||||||
|
bodyValue, bodyValueType);
|
||||||
|
|
||||||
super(httpMethod, uri, uriBuilderFactory, uriTemplate, uriVars, headers, cookies, version, attributes, bodyValue);
|
|
||||||
this.body = body;
|
this.body = body;
|
||||||
this.bodyElementType = elementType;
|
this.bodyElementType = elementType;
|
||||||
}
|
}
|
||||||
|
@ -237,12 +241,13 @@ public final class ReactiveHttpRequestValues extends HttpRequestValues {
|
||||||
@Nullable HttpMethod httpMethod,
|
@Nullable HttpMethod httpMethod,
|
||||||
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
|
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
|
||||||
@Nullable String uriTemplate, Map<String, String> uriVars,
|
@Nullable String uriTemplate, Map<String, String> uriVars,
|
||||||
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
|
HttpHeaders headers, MultiValueMap<String, String> cookies,
|
||||||
Map<String, Object> attributes, @Nullable Object bodyValue) {
|
@Nullable Object version, Map<String, Object> attributes,
|
||||||
|
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType) {
|
||||||
|
|
||||||
return new ReactiveHttpRequestValues(
|
return new ReactiveHttpRequestValues(
|
||||||
httpMethod, uri, uriBuilderFactory, uriTemplate, uriVars,
|
httpMethod, uri, uriBuilderFactory, uriTemplate, uriVars,
|
||||||
headers, cookies, version, attributes, bodyValue, this.body, this.bodyElementType);
|
headers, cookies, version, attributes, bodyValue, bodyValueType, this.body, this.bodyElementType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue