REST API Web Service based on Spring MVC / Security

This sample Java Web based project was developed for a research and test purposes, which shows:


  • Spring MVC 3.0.5 based implementation of RESTful Web Service for GET, POST, PUT, DELETE methods
  • Web service authentication based on Spring Security 3.0.5 (HTTP Basic Auth)
  • A sample web service client (front end) based on Spring MVC 3.0.5. Web client uses Spring RestTemplate to talk with RESTful Web service, for passing authentication it uses Apache Commons HttpClient library
  • Spring JDBC Template based Database access (PostgerSQL 9.0.2)

Web Application consists of 2 parts:


  1. The core service back-end on the base of REST style Web Service to represent access to products database
  2. The web based front-end for online store (nothing fancy, just shows categories and products sorted by price)

Configuration files:


  1. restservice-auth.properties file holds authentication parameters of the core RESTful Web Service
  2. webclient-auth.properties file holds authentication parameters of Web Client to access RESTful Web Service
  3. jdbc.properties file holds database access parameters

I used FireFox with REST Client plugin for testing GET, POST, PUT, DELETE methods of the Web Service




A sample web front-end looks like:




The project is developed using Netbeans IDE 6.7.1 (Ant based build) and tested on Sun JDK 1.0.6_22, Tomcat 6.0.18 / Jetty (jetty-distribution-7.2.2.v20101205) and PostgreSQL 9.0.2 database.


At the end one note, please. As this project was developed for a research and test purposes, so be informed that input validation and exception handling procedures are not implemented here. Also, the front page wishes about a good design ;)


Zip file attached below includes all sources and a script file to create database schema and tables.

Download Project Source (6.4MB)














IT / Coding / How-To


Other Topics