What is the difference between implementing a RESTful web service and a plain HTTPServlet. All GET/POST/DELETE/PUT are supported in Servlet as well as any REST API.
-
What actually you mean by `RESTful web service`? – Andremoniy Jan 14 '13 at 07:39
5 Answers
REST is really an architectural style used when designing an API on a server. HttpServlets can be a method of implementing a RESTful web service.
REST describes a style where HTTP verbs like GET/POST/DELETE/etc. are used in a predictable way to interact with resources on a server.
I'd recommend reading through the REST Wikipedia page for a good overview.

- 10,323
- 2
- 30
- 45
REST is an architectural pattern (abstract), while servlets are an implementation.

- 7,550
- 4
- 25
- 33
My 5 cents here :) As for me - Servlets are just an abstraction over HTTP protocol. It supports GET/PUT and so on because the Http Protocol defines these methods.
Restful web service on the other hand is an abstract notion that talks about the ideology of operation the resource, rather than particular implementation. Its true that its very convenient to think about rest functionality in a context of HTTP protocol, but try to think about them as they're entirely different beasts. Restful web service is not something Java specific.
Technically if you're talking about Java, restful web service can be implemented with vanilla servlets, or one can use tools like Apache Wink or Jersey that define a convenient way of implementing rest services, but these are after all just tools. BTW, Jersey (as I know, I don't know about others) is implemented on top of servlets.
Hope this helps

- 39,963
- 4
- 57
- 97
An HttpServlet responds to HTTP methods in a way that the programmer deems fit. A RESTful web service should be based on handling of entities. The CRUD should corresponds to HTTP method POST, GET, PUT and DELETE. Also the url should be defined according to a format, e.g. {server}/{entities}, {server}/{entities}/{id} etc.

- 645
- 1
- 7
- 20
As the name suggest the RESTful web service is a web service which is used to establish communication between 2 different server and hence helps in integration of web based application.web service uses HTTP protocol. Whereas, HTTPServlet is a Servlet that support HTTP calls. The different methods in this all support HTTP protocol.

- 75
- 1
- 4