Posts

Showing posts from August, 2013

Restful code example using Spring MVC

In my previous blog, I talked about Restful webservices design. In this blog, I will provide sample code for the same using Spring MVC framework.

Spring MVC 3.x supports annotation based controllers, which are Restful in nature. 

Let us create a sample Spring web application for performing CRUD on User entity.


Creating project:Create a Maven project with a archetype 'maven-archetype-webapp'.
pom.xml <!-- version property --> <properties> <spring.version>3.1.2.RELEASE</spring.version> </properties> <!-- servlet dependency for compilation --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <type>jar</type> <scope>compile</scope> </dependency> <!-- Spring MVC dependencies --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</arti…

Restful Webservices

This article is about Restful webservices and some thoughts on its design/architecture.

REST stands for Representative State Transfer. Restful architecture is resource oriented. The services expose a set of resources to the client and client can perform a set of operations on the resources which modify the state of the resource.

Design:Restful webservices design requires a paradigm shift in the way we think about designing services. In the SOAP world, it was all about operations. So we used to think, what will this webservice "DO". But that is something which we should not do in Restful. 

Let's take for example an order entry application. In the SOAP world, we would think about services like createOrder, updateOrder, addLineItems etc. To design the same in Restful world, we need to identify all the resources in the application which the client cares about. These resources need not necessarily have a one to one mapping to the underlying schema. It is just the resources which…

The Beginning.....

I wanted to blog on technical stuff since long and finally it has taken off.

My primary focus will be on Java and J2EE architecture, design patterns and SOA. The blog content could be my thoughts on design and architecture  or could also be a step by step tutorial stuff.

I will also try to post a few on AI which is my personal favorite topic, but I'm still a novice in this area. AI being a vast field with so many disciplines in it, my posts on AI will be purely basic and rudimentary.