• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Rest web service and normal servlet

 
francis varkey
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What is the difference between rest web service and a normal servlet that return xml data. ?

Thanks,
 
Ganesh Kandisa
Greenhorn
Posts: 6
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think difference lies in the way they get input content instead of the return type. Servlet gets only HttpRequest/HttpResponse objects where as for REST method you have control how you will provide input to it..


Ganesh Kandisa
-------------------------------
OCPJP(93%),OCPWCD(92%)
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't necessarily a difference. A servlet returning XML could be considered a web service if it adheres to the REST principles.

It's probably more common for REST services to use JSON than XML, but the data format is not a defining characteristic of REST.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
REST calls for a strict architectural style, as the Wikipedia article Ulf cites explains.

There is no restriction (XML, JSON, whatever) on the kind of resource a RESTful service can respond with.

In addition to the common GET, and POST requests, a RESTful server may be designed to handle other HTTP actions such as DELETE, PUT, HEAD. and (with HTTP1.1), PATCH.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic