- RESTful - Discussion
- RESTful - Useful Resources
- RESTful - Quick Guide
- RESTful - Questions and Answers
- RESTful - Java (JAX-RS)
- RESTful - Security
- RESTful - Caching
- RESTful - Statelessness
- RESTful - Methods
- RESTful - Addressing
- RESTful - Messages
- RESTful - Resources
- RESTful - First Application
- RESTful - Environment Setup
- RESTful - Introduction
- RESTful - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
RESTful Web Services - Statelessness
As per the REST architecture, a RESTful Web Service should not keep a cpent state on the server. This restriction is called Statelessness. It is the responsibipty of the cpent to pass its context to the server and then the server can store this context to process the cpent s further request. For example, session maintained by server is identified by session identifier passed by the cpent.
RESTful Web Services should adhere to this restriction. We have seen this in the
chapter, that the web service methods are not storing any information from the cpent they are invoked from.Consider the following URL −
https://localhost:8080/UserManagement/rest/UserService/users/1
If you hit the above url using your browser or using a java based cpent or using Postman, result will always be the User XML whose Id is 1 because the server does not store any information about the cpent.
<user> <id>1</id> <name>mahesh</name> <profession>1</profession> </user>
Advantages of Statelessness
Following are the benefits of statelessness in RESTful Web Services −
Web services can treat each method request independently.
Web services need not maintain the cpent s previous interactions. It simppfies the apppcation design.
As HTTP is itself a statelessness protocol, RESTful Web Services work seamlessly with the HTTP protocols.
Disadvantages of Statelessness
Following are the disadvantages of statelessness in RESTful Web Services −
Web services need to get extra information in each request and then interpret to get the cpent s state in case the cpent interactions are to be taken care of.