Polish
This commit is contained in:
@@ -182,10 +182,11 @@ public class ResponseBodyResultHandler implements HandlerResultHandler, Ordered
|
||||
|
||||
MediaType bestMediaType = selectBestMediaType(compatibleMediaTypes);
|
||||
if (bestMediaType != null) {
|
||||
HttpMessageConverter<?> converter = resolveEncoder(elementType, bestMediaType);
|
||||
if (converter != null) {
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
return converter.write((Publisher) publisher, elementType, bestMediaType, response);
|
||||
for (HttpMessageConverter<?> converter : this.messageConverters) {
|
||||
if (converter.canWrite(elementType, bestMediaType)) {
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
return converter.write((Publisher) publisher, elementType, bestMediaType, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,13 +250,4 @@ public class ResponseBodyResultHandler implements HandlerResultHandler, Ordered
|
||||
return null;
|
||||
}
|
||||
|
||||
private HttpMessageConverter<?> resolveEncoder(ResolvableType type, MediaType mediaType) {
|
||||
for (HttpMessageConverter<?> converter : this.messageConverters) {
|
||||
if (converter.canWrite(type, mediaType)) {
|
||||
return converter;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user