• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to conserve the state with REST

 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm developing a REST web services based application. I'm wondering if i can use stateful beans to conserve the state between differents REST requests?
Please help
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the idea behind RESTful services is to stick to basic HTTP operations, and HTTP is basically stateless, you will have to code your own state preserving functions.

This will require cooperation between client and service - what is the client you expect your service to work with?

Bill
 
Smari Oumaya
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i'm developing a RESt services based forum. I'm using JSP in the interface.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Looking at the Wikipedia article on REST and the constraints of the architectural style, you find statelessness.
http://en.wikipedia.org/wiki/Representational_State_Transfer#Constraints
In my opinion, there is nothing like a stateful REST service - it would be a contradiction.
What may be useful in a situation like that is to change the mindset: What are you trying to accomplish by introducing a state?
Would it be possible to store the information you want to contain in the state as a resource and pass an URI to that resource when issuing a request to another resource?
This way, the state would become just another resource which adheres to the same constraints as all the other resources and suddenly you have your RESTful web service with all the benefits of RESTful web services intact.
Best wishes!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!