|
If you need a temporary but quick and working fix use the following extension of ContentNegotiatingViewResolver and configure it in your application context. <code> import javax.servlet.http.*; public class MyContentNegotiatingViewResolver extends ContentNegotiatingViewResolver { protected List<MediaType> getMediaTypes(HttpServletRequest request) {
List<MediaType> result = super.getMediaTypes(request);
if (result.size() == 1) result = Arrays.asList(result.get(0));
return result;
} Thanks for raising this! Fixed in trunk now. Juergen |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The problem is that the ContentNegotiatingViewResolver.getMediaTypes() method when a path extension is not available and the ignoreAcceptHeader is set to true and a defaultContentType has been configured returns a list in the following way:
if (defaultContentType != null) { return Collections.singletonList(defaultContentType); }
that, as it has been reported, cannot be sort by the Collections.sort() method invoked in the ContentNegotiatingViewResolver.resolveViewName() one.
I hope this helps