• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Servlet v/s REST

 
Ranch Hand
Posts: 441
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We can achieve the same thing using servlets and REST. What is the difference between Servlets and REST?
 
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 441
2
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic