Thank you. That clears my doubt.
So you mean we can make use of the headers to get the session tracking
functionality.
Thanks,
Naresh
Lars Tackmann wrote:
> On Mon, Aug 11, 2008 at 8:26 AM, Srinivas Naresh Bhimisetty
> <Srinivas.Bhimisetty_at_sun.com> wrote:
>
>> Hi,
>>
>> this is a Jersey newbie. I was going through some docs which said, RESTful
>> web services are stateless.
>> If these are stateless, would it be possible for someone to create a RESTful
>> web service which has to maintain the session information for the different
>> actions, i.e., if I want to write a web service, something like a Credit
>> Card Transaction, how would I maintain the state if I want to write it the
>> RESTful way. Is it possible? Is the RESTful approach suitable only for few
>> kind of services?
>> I think I'm confused. Could somebody please elaborate this particular
>>
>
> RESTful services does not maintain state the usual way (i.e. a cookie
> id used to retrieve a server side session). This does however not
> prevent you from creating a credit card transactional resource -
> consider this flow:
>
> ----
> post /creditcard/transaction => get a transaction id in location
> header (say: 42)
> put /creditcard/42 => put work (in entity body) on to the transaction
> :
> put /creditcard/42/commit => commit transaction
> ----
>
> this way you create a transactional id, add work to it and on commit
> you simply execute all this work in a server side transaction. Further
> functionality, like a rollback resource or transaction timeout are
> equally easy to add.
>
> Hope this helps
>
>
>