Update Codec API to use Map<String, Object> for hints
Issue: SPR-14557
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.web.reactive.result.view;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -123,7 +124,7 @@ public class HttpMessageWriterView implements View {
|
||||
else if (map.size() == 1) {
|
||||
return map.values().iterator().next();
|
||||
}
|
||||
else if (getMessageWriter().canWrite(ResolvableType.forClass(Map.class), null)) {
|
||||
else if (getMessageWriter().canWrite(ResolvableType.forClass(Map.class), null, Collections.emptyMap())) {
|
||||
return map;
|
||||
}
|
||||
else {
|
||||
@@ -142,10 +143,10 @@ public class HttpMessageWriterView implements View {
|
||||
protected boolean isEligibleAttribute(String attributeName, Object attributeValue) {
|
||||
ResolvableType type = ResolvableType.forClass(attributeValue.getClass());
|
||||
if (getModelKeys().isEmpty()) {
|
||||
return getMessageWriter().canWrite(type, null);
|
||||
return getMessageWriter().canWrite(type, null, Collections.emptyMap());
|
||||
}
|
||||
if (getModelKeys().contains(attributeName)) {
|
||||
if (getMessageWriter().canWrite(type, null)) {
|
||||
if (getMessageWriter().canWrite(type, null, Collections.emptyMap())) {
|
||||
return true;
|
||||
}
|
||||
throw new IllegalStateException(
|
||||
@@ -163,7 +164,8 @@ public class HttpMessageWriterView implements View {
|
||||
Publisher<? extends T> stream = Mono.just((T) value);
|
||||
ResolvableType type = ResolvableType.forClass(value.getClass());
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
return ((HttpMessageWriter<T>) getMessageWriter()).write(stream, type, contentType, response);
|
||||
return ((HttpMessageWriter<T>) getMessageWriter()).write(stream, type, contentType,
|
||||
response, Collections.emptyMap());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.web.reactive.result.method.annotation;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
@@ -386,7 +387,7 @@ public class RequestMappingMessageConversionIntegrationTests extends AbstractReq
|
||||
DataBufferFactory dataBufferFactory = new DefaultDataBufferFactory();
|
||||
Jackson2JsonEncoder encoder = new Jackson2JsonEncoder();
|
||||
return encoder.encode(Mono.just(new Person("Robert")), dataBufferFactory,
|
||||
ResolvableType.forClass(Person.class), JSON).map(DataBuffer::asByteBuffer);
|
||||
ResolvableType.forClass(Person.class), JSON, Collections.emptyMap()).map(DataBuffer::asByteBuffer);
|
||||
}
|
||||
|
||||
@GetMapping("/flux")
|
||||
|
||||
Reference in New Issue
Block a user