Description
Kenny MacLeod opened SPR-4927 and commented
Prior to the use of Spring 2.5 @RequestMapping
, if I wanted to limit my controller to accepting POST requests only, I simply injected POST into the controller, and a GET request would result in a very specific "this controller only support POST" error.
When I use @RequestMapping
(method=POST), however, and send a GET request to the controller, I get an entry in the logs saying "No matching handler method found for ... , method 'GET'", and a 404 is returned to the client.
This seems like a step backwards to me. I only noticed because a client was accidentally sending GET requests to a POST-only controller, and the resulting 404 caused some confusion, running around and general pointing of fingers. A 404 doesn't seem to be the correct response.
I'd like to suggest 406 (NOT ACCEPTABLE), but that may cause even more confusion. Even a 500 would be preferably to a 404 here, i think.
Affects: 2.5.4
Issue Links:
- @Controller method order effects @RequestMapping behavior in ways not expected [SPR-5731] #10401
@Controller
method order effects@RequestMapping
behavior in ways not expected - Comprehensive REST Support [SPR-4419] #9097 Comprehensive REST Support