-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Oliver Drotbohm opened SPR-6467 and commented
Currently ContentNegotiatingViewResolver acts lenient as it returns null when it can not resolve any view to indicate that further ViewResolvers configured shall step in and try to resolve the view.
In cases when ContentNegotiatingViewResolver is the only resolver configured, not resolving the view should be answered with a 406 Not Acceptable status code. A quick hack I did was to add a property beStrict to CNVR an implement an inner class to return the appropriate statuscode. See applied patch.
This solves the problem at a first glance but I think it would be more clean to prevent processing of the request entirely if no valid accept header was set by using the algorithm getmediaTypes(..) in CNVR. Currently this method is not public, but I could imagine a HandlerInterceptor implementation that gets a reference to the CNVR injected and call to getMediaType(..) to decide whether to process the request at all.
Affects: 3.0 RC2
Attachments:
- bestrict.patch (2.43 kB)
Issue Links:
- exotic MIME-Type leads to 500 Internal Server Error [SPR-6894] #11559 exotic MIME-Type leads to 500 Internal Server Error ("is duplicated by")
Referenced from: commits 1cd0a97