This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Request method 'PUT' not supported

Jan 28th, 2010, 08:15 AM

i try to make a very simple demo for spring3.0 rest mvc webapp.
The GET,POST,DELETE three http methods work well, but PUT method not.exception:

Code:

Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'uncaughtException'; model is {exception=org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported}
org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'PUT' not supported
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter$ServletHandlerMethodResolver.resolveHandlerMethod(AnnotationMethodHandlerAdapter.java:567)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:409)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:574)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:640)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Comment

I'm a bit of a newbie so sorry if this is a really silly question, but should this:

Code:

@RequestMapping(value="/{id}", method = RequestMethod.PUT)

be this:

Code:

@RequestMapping(value="/{id}/update", method = RequestMethod.PUT)

?

PUK

in rest style.

Code:

url http method action
http://host/app/users get list users
http://host/app/users/new get show create user form
http://host/app/users/1 get show user[id=1]
http://host/app/users/1/update get show edit form for user[id=1]
http://host/app/users/1 put submit the edit form

Comment

Usually what this error means is that there is not a method in the controller that will handle a PUT request for the url mapping being supplied. I think PUK_999 was onto the right path. I'd double check the path in the request url.

Comment

Usually what this error means is that there is not a method in the controller that will handle a PUT request for the url mapping being supplied. I think PUK_999 was onto the right path. I'd double check the path in the request url.