Spring 3 RESTful Web Services: And with Minimal Coding and Configuration


News: Spring 3 RESTful Web Services: And with Minimal Coding and Configuration

  1. Spring 3 provides support for RESTful Web services through its MVC framework.

    The most popular approach for implementing RESTful Web services is Sun's JAX-RS specification. There are several projects available that support JAX-RS such as CXF, Jersey, RESTEasy and Restlet. Most of them provide Spring support also. Spring does not directly support JAX-RS, instead RESTful functionality is added to feature Spring MVC itself.

    Spring MVC stands for Model View Controller. It helps in building flexible and loosely coupled web applications. The Model – View – Controller design pattern insures separation of concerns (business logic, presentation logic and navigation logic) in a multi-tier web application. "Controllers" are responsible for receiving the request from the user and calling the back – end services. Models are responsible for encapsulating the application data. Views render response back to the user with using the model object. In short :

    When a request is sent to the Spring MVC Framework the following sequence of events happen.

    *** The “DispatcherServlet? first receives the request
    *** The “DispatcherServlet? consults the “HandlerMapping? and invokes the "Controller" associated with the request
    *** The "Controller" process the request by calling the appropriate service methods and returns a “ModeAndView? object to the “DispatcherServlet?. The “ModeAndView? object contains the model data and the view name
    *** The “DispatcherServlet? sends the view name to a “ViewResolver? to find the actual “View? to invoke
    *** The “DispatcherServlet? passes the model object to the “View? to render the result
    *** The “View? with the help of the model data renders the result and return it back to the user

    Enough talk! Lets get our hands dirty:

    Java Code Geeks : Spring 3 RESTful Web Services

    In this tutorial we will show you how to implement a RESTful Web service in Spring or, if you want, to expose an existing Spring service as a RESTful Web service. CRUD (Create - Retrieve - Update - Delete) functionality will be exposed over a RESTful interface providing XML or JSON representation of domain data depending on client preferences! All with minimal coding and configuration.

    Threaded Messages (1)

  2. Documentation[ Go to top ]

    If you're interested in generating documentation for a standard Spring 3 RESTful service, you should check out RESTdoclet (recently outsourced by IG Group).  More info and links here: http://soaprobe.blogspot.co.uk/2012/07/rest-service-documentation-using.html