Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 11. Giving Spring some REST > Submitting RESTful forms

11.5. Submitting RESTful forms

We’ve seen how the four primary HTTP methods—GET, POST, PUT, and DELETE—define the basic operations that can be performed on a resource. And by setting the method attribute of the @RequestMapping annotation appropriately, we can cause DispatcherServlet to direct requests for those HTTP verbs to specific controller methods. Spring MVC can handle requests for any of the HTTP methods—assuming the client sends the requests in the form of the desired HTTP method.

The gotchas in that plan are HTML and the web browser. Non-browser clients, such as those that use RestTemplate, should have no trouble sending requests to perform any of the HTTP verbs. But HTML 4 only officially supports GET and POST in forms, leaving PUT, DELETE, and all other HTTP methods in the cold. Even though HTML 5 and newer browsers will support all of the HTTP methods, you probably can’t count on the users of your application to be using a modern browser.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial