Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between RESTful webservice and HttpServlet [duplicate]

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.

like image 578
Alok Avatar asked Jan 14 '13 07:01

Alok


People also ask

What is the difference between a REST API and RESTful web services?

Put simply, there are no differences between REST and RESTful as far as APIs are concerned. REST is the set of constraints. RESTful refers to an API adhering to those constraints. It can be used in web services, applications, and software.

What is the use of HttpServlet?

HTTP servlets can read HTTP headers and write HTML coding to deliver a response to a browser client. Servlets are deployed on WebLogic Server as part of a Web Application. A Web Application is a grouping of application components such as servlet classes, JavaServer Pages (JSP), static HTML pages, images, and security.

What is the difference between API and HTTP request?

HTTP is a communication protocol as we have just gone over. So an HTTP API is just an API ( a system that helps two software entities communicate with each other ) that uses HTTP to communicate and doesn't have any other major modifications or constraints placed upon it.

Is HttpServlet an interface?

The HttpServlet class extends the GenericServlet class and implements a Serializable interface.


2 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.

like image 192
Marc Baumbach Avatar answered Oct 29 '22 09:10

Marc Baumbach


REST is an architectural pattern (abstract), while servlets are an implementation.

like image 35
Kurt Du Bois Avatar answered Oct 29 '22 08:10

Kurt Du Bois