• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Servlet v/s REST  RSS feed

 
Ranch Hand
Posts: 381
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can achieve the same thing using servlets and REST. What is the difference between Servlets and REST?
 
Marshal
Posts: 67197
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vaibhav Gargs wrote: We can achieve the same thing using servlets and REST.


I would ask you to defend this assumption.
 
Bartender
Posts: 9559
189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The whole comparison doesn't make sense.

A servlet is a piece of code that handles requests. REST is just a set of design guidelines.
 
Vaibhav Gargs
Ranch Hand
Posts: 381
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bear and Stephan. As per my understanding, we can handle HTTP GET/POST/DELETE/PUT requests using servlets as well as REST services. So, just thinking what makes them different? And, for REST services also, I believe they first hit the servlets only e.g. JerseyServlet for Jersey implementation, dispatcherservlet in case of Spring REST.
 
Bear Bibeault
Marshal
Posts: 67197
169
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets are a general-purpose request/response mechanism built in Java. REST is a convention for data interchange. Sure, you could use servlets to build a REST API, but that doesn't make them the same thing.

It's like asking what the difference is between a pile of bricks, and a brick house. The bricks can be used to build the house, but you can't say that the bricks and the house are interchangeable.
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!