Issue Details (XML | Word | Printable)

Key: SPR-3552
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: Alef Arendsen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Framework

DispatcherServlet should throw 405 when detecting an unsupported operation

Created: 04/Jun/07 11:06 AM   Updated: 10/Mar/08 05:36 AM
Component/s: SpringWEB
Affects Version/s: 2.0.5
Fix Version/s: 2.5.3

Time Tracking:
Not Specified


 Description  « Hide
When an unsupported HTTP method is called upon, the DispatcherServlet should raise an SC_METHOD_NOT_ALLOWED (405). Currently it throws an HttpRequestMethodNotSupportException instead. I couldn't find code that converts this exception to a 405 and the last time I found this was a while ago, so it could have been solved in the meantime... If so, please ignore ;-).

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Adam Taft added a comment - 05/Mar/08 09:08 PM
Just wanted to comment on this bug. I'm thinking really that any time HttpRequestMethodNotSupportedException is thrown, it should result in a 405 status being set (at least by default).

In my case, I'm setting up a HessianServiceExporter. When I request the service via HTTP GET, the server I'm using (Tomcat) returns a 500 error condition. The HTTP spec gives status code 405 specifically to address this scenario.

I have no clue as to where it's appropriate to trap the HttpRequestMethodNotSupportException and cause it to set the appropriate 405 status headers. It seems that DispatcherServlet and the remoting related servlets have a different hierarchy and not common concrete class between them to handle HTTP responses. So, the fix here would likely involve needing a change multiple classes, probably including FrameworkServlet and HttpRequestHandlerServlet.


Juergen Hoeller added a comment - 10/Mar/08 05:36 AM
This is addressed in the latest 2.5.3 snapshot already (available from http://static.springframework.org/downloads/nightly/snapshot-download.php?project=SPR), at least for DispatcherServlet's purposes. I have now addressed this for HttpRequestHandlerServlet as well (to be available in tonight's 2.5.3 snapshot).

Juergen