Spring MVC RESTFul GET POST PUT DELETE

Spring MVC RESTFul GET POST PUT DELETE

To build a Java enterprise application spring is well known framework. Today we will build RESTFul web service using Spring MVC framework. As we you know RESTFul web service produces multiple representation based on the request from client. In this demo you will learn how to process all representation of RESTFul web service i.e. GET, POST, PUT and DELETE and also how to use spring annotation and mapping.

  • Spring MVC maven project structure:

Spring MVC RESTFul GET POST PUT DELETE

  • pom.xml:

  • web.xml:

  • dispatcher-servlet.xml:

  • SpringMVCRESTFulController.java:

  • Download complete project from below link. You can deploy and test on any server but for demo purpose I have used tomcat 7.
  • To test this RESTFul web service install Postman – REST Client chrome extension. Once its installed open in chrome use below URL to send request to the server:

GET Request:

Spring MVC RESTFul GET POST PUT DELETE

POST Request:

Spring MVC RESTFul GET POST PUT DELETE

PUT Request:

Spring MVC RESTFul GET POST PUT DELETE

DELETE Request:

Spring MVC RESTFul GET POST PUT DELETE

Note: You can also refer different type of request mapping, processing using Spring MVC tutorial which had been written before below:

For more details on Spring MVC RESTFul web service please visit spring official tutorial here

download  Download project:  SpringMVCRESTFulExample

4 thoughts on “Spring MVC RESTFul GET POST PUT DELETE

  1. Hello Sir,
    Iam very much thank you for your tutorials. it is very much helping me learning.
    When I try this tutorial, GET,PUT,DELETE working, but the POST method did not working, the below error coming, please help sir
    org.springframework.web.servlet.PageNotFound handleHttpRequestMethodNotSupported
    WARNING: Request method ‘POST’ not supported

    expecting your help

Leave a Reply

Your email address will not be published. Required fields are marked *