SPR-6466 - ContentNegotiatingViewResolver can not handle View implementations returning null as content type

This commit is contained in:
Arjen Poutsma
2009-11-30 10:10:27 +00:00
parent c8d6360855
commit 73b54f4efe
2 changed files with 34 additions and 6 deletions

View File

@@ -350,12 +350,15 @@ public class ContentNegotiatingViewResolver extends WebApplicationObjectSupport
}
for (View candidateView : candidateViews) {
MediaType viewMediaType = MediaType.parseMediaType(candidateView.getContentType());
for (MediaType requestedMediaType : requestedMediaTypes) {
if (requestedMediaType.includes(viewMediaType)) {
if (!views.containsKey(requestedMediaType)) {
views.put(requestedMediaType, candidateView);
break;
String contentType = candidateView.getContentType();
if (StringUtils.hasText(contentType)) {
MediaType viewMediaType = MediaType.parseMediaType(contentType);
for (MediaType requestedMediaType : requestedMediaTypes) {
if (requestedMediaType.includes(viewMediaType)) {
if (!views.containsKey(requestedMediaType)) {
views.put(requestedMediaType, candidateView);
break;
}
}
}
}