aspose file tools*
The moose likes Web Services and the fly likes Rest web service and normal servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Rest web service and normal servlet" Watch "Rest web service and normal servlet" New topic
Author

Rest web service and normal servlet

francis varkey
Ranch Hand

Joined: Sep 13, 2005
Posts: 165
Hi,
What is the difference between rest web service and a normal servlet that return xml data. ?

Thanks,
Ganesh Kandisa
Greenhorn

Joined: Jul 27, 2011
Posts: 6

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%)


Ganesh Kandisa
OCPJP 6(93%),OCPWCD 5(92%)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39547
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12678
    
    5
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

Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rest web service and normal servlet
 
Similar Threads
applet to servlet communication
Normal Web Serivce SEI
Normal Web Serivce SEI
Spring: Creating a servlet/controller to handle REST calls
Need to connect to DB and get some records