SPR-4927 - Return 405 instead of 404 when HTTP method is not supported

This commit is contained in:
Arjen Poutsma
2009-05-11 13:32:28 +00:00
parent 752832a8da
commit 0a6cac5a84
2 changed files with 52 additions and 0 deletions

View File

@@ -446,6 +446,10 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator implemen
if (match && mappingInfo.methods.length == 0 && mappingInfo.params.length == 0 &&
resolvedMethodName != null && !resolvedMethodName.equals(handlerMethod.getName())) {
match = false;
} else {
for (RequestMethod requestMethod : mappingInfo.methods) {
allowedMethods.add(requestMethod.toString());
}
}
}
if (match) {