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

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2543 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Arjen Poutsma
2009-11-30 10:10:27 +00:00
parent d7906963a3
commit bc327a000e
2 changed files with 34 additions and 6 deletions
@@ -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;
}
}
}
}