• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to conserve the state with REST

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i'm developing a RESt services based forum. I'm using JSP in the interface.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
For my next trick, I'll need the help of a tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic