|
|
ContentNegotiatingViewResolver: Responding to Bad REST Calls
Using 3.0.0.RC1, I've jumped through the hoops involved in configuring the ContentNegotiatingViewResolver using a BeanFactory per ViewResolver, as described here:
showthread.php?p=249805
Now I have a question about how to configure the response when a request comes in for an unsupported content type. Per from, I should return a 406 response code. There doesn't appear to be any kind of support for this in the ContentNegotiatingViewResolver, as it just returns null if no views can be found that match the requested content type. That's where it seems this code should be. Is there a way to have Spring handle this for me?
I can also see a need to respond with a 400, quot;Bad Requestquot;, if someone makes a REST call with bad parameters and possibly a 405, quot;Method Not Allowedquot;, if someone tries to call a ucl with an unsupported request method. What's the proper way to handle these responses in Spring 3? |
|