Revise how bodyType is set for 7.0 codebase
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run Details

See gh-34793
This commit is contained in:
rstoyanchev 2025-04-25 21:41:11 +01:00
parent fed6e9b3c3
commit d8503daa1f
2 changed files with 26 additions and 24 deletions

View File

@ -75,18 +75,19 @@ public class HttpRequestValues {
private final @Nullable Object bodyValue;
private @Nullable ParameterizedTypeReference<?> bodyValueType;
private final @Nullable ParameterizedTypeReference<?> bodyValueType;
/**
* Construct {@link HttpRequestValues}.
* @since 6.1
* @since 7.0
*/
protected HttpRequestValues(@Nullable HttpMethod httpMethod,
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
@Nullable String uriTemplate, Map<String, String> uriVariables,
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
Map<String, Object> attributes, @Nullable Object bodyValue) {
HttpHeaders headers, MultiValueMap<String, String> cookies,
@Nullable Object version, Map<String, Object> attributes,
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType) {
Assert.isTrue(uri != null || uriTemplate != null, "Neither URI nor URI template");
@ -100,6 +101,7 @@ public class HttpRequestValues {
this.version = version;
this.attributes = attributes;
this.bodyValue = bodyValue;
this.bodyValueType = bodyValueType;
}
@ -511,14 +513,9 @@ public class HttpRequestValues {
Map<String, Object> attributes = (this.attributes != null ?
new HashMap<>(this.attributes) : Collections.emptyMap());
HttpRequestValues requestValues = createRequestValues(
return createRequestValues(
this.httpMethod, uri, uriBuilderFactory, uriTemplate, uriVars,
headers, cookies, this.version, attributes, bodyValue);
// In 6.2.x only, temporarily work around protected methods
requestValues.bodyValueType = this.bodyValueType;
return requestValues;
headers, cookies, this.version, attributes, bodyValue, this.bodyValueType);
}
protected boolean hasParts() {
@ -557,18 +554,18 @@ public class HttpRequestValues {
/**
* Create {@link HttpRequestValues} from values passed to the {@link Builder}.
* @since 6.1
* @since 7.0
*/
protected HttpRequestValues createRequestValues(
@Nullable HttpMethod httpMethod,
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory, @Nullable String uriTemplate,
Map<String, String> uriVars,
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
Map<String, Object> attributes, @Nullable Object bodyValue) {
Map<String, String> uriVars, HttpHeaders headers, MultiValueMap<String, String> cookies,
@Nullable Object version, Map<String, Object> attributes,
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType) {
return new HttpRequestValues(
this.httpMethod, uri, uriBuilderFactory, uriTemplate,
uriVars, headers, cookies, version, attributes, bodyValue);
uriVars, headers, cookies, version, attributes, bodyValue, bodyValueType);
}
}

View File

@ -50,12 +50,16 @@ public final class ReactiveHttpRequestValues extends HttpRequestValues {
@Nullable HttpMethod httpMethod,
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
@Nullable String uriTemplate, Map<String, String> uriVars,
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
Map<String, Object> attributes,
@Nullable Object bodyValue, @Nullable Publisher<?> body,
@Nullable ParameterizedTypeReference<?> elementType) {
HttpHeaders headers, MultiValueMap<String, String> cookies,
@Nullable Object version, Map<String, Object> attributes,
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType,
@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.bodyElementType = elementType;
}
@ -237,12 +241,13 @@ public final class ReactiveHttpRequestValues extends HttpRequestValues {
@Nullable HttpMethod httpMethod,
@Nullable URI uri, @Nullable UriBuilderFactory uriBuilderFactory,
@Nullable String uriTemplate, Map<String, String> uriVars,
HttpHeaders headers, MultiValueMap<String, String> cookies, @Nullable Object version,
Map<String, Object> attributes, @Nullable Object bodyValue) {
HttpHeaders headers, MultiValueMap<String, String> cookies,
@Nullable Object version, Map<String, Object> attributes,
@Nullable Object bodyValue, @Nullable ParameterizedTypeReference<?> bodyValueType) {
return new ReactiveHttpRequestValues(
httpMethod, uri, uriBuilderFactory, uriTemplate, uriVars,
headers, cookies, version, attributes, bodyValue, this.body, this.bodyElementType);
headers, cookies, version, attributes, bodyValue, bodyValueType, this.body, this.bodyElementType);
}
}