Rest Web Services

What is Rest Web Services?

Rest stands for Representational State Transfer. REST was first described by Roy Fielding in 2000. REST is an architectural style not a protocol. Resource is everything in Rest architecture. A resource is accessed via a common interface based on the HTTP standard methods.

In REST architecture, a REST Server simply provides access to resources and REST client accesses and presents the resources. Here each resource is identified by URIs/ global IDs. Restful web service permits different data format such as Plain Text, HTML, XML and JSON. Restful web services can use SOAP web services as the implementation.

Http Methods:

Following are well known used http methods in rest based architecture.

  • GET – the resource is never changed via get request nothing but idempotent. It provides only read only access.
  • PUT – used creates a new must also be idempotent.
  • DELETE – used remove the is also idempotent.
  • POST – Used to update an existing resource or create a new resource.
  • OPTION – Used get supported operation on a resource.

Features of REST web services

Every system uses resources. These resources can be pictures, video files, Web pages, business information, or anything that can be represented in a computer-based system. The purpose of a service is to provide a window to its clients so that they can access these resources. Restful web services have following properties and features.

  • Representations
  • Messages
  • URIs
  • Uniform interface
  • Stateless
  • Links between resources
  • Caching

Advantages of Restful web services:

  • Restful web services are fast because there is no strict specification like SAOP and it consumes less bandwidth and resource.
  • Restful web service are platform and language independent.
  • Restful web service can implement Soap services.
  • Restful web service allow different data format such as plain text, xml, json and html.

Restful web service with Jersey framework

Jersey is the reference implementation for the JSR 311 specification. The Jersey implementation also provides a client library to communicate with a RESTful web service. The Jersey implementation provides a library to implement Restful web services in a Java servlet container.


  • JDK
  • Eclipse
  • Jersey framework libraries
  • Apache tomcat
  • Maven

Hello Word Example:

Time to Action:

Create a Standard maven project by running below maven command.

Rest Web service
Rest Web service

Add jersey project dependency in pom.xml.

Create a new service with name “HelloWorldService”.

In web.xml, register “com.sun.jersey.spi.container.servlet.ServletContainer“,and puts your Jersey service folder under “init-param“, ““.

Woww we done it. We can see demo by running the application.

Related Posts :-

Related posts:

1 Comment

Leave a Reply

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

Show Buttons
Hide Buttons