R – How to we maintain State in Webservices

web-services

How can we maintain State in Webservices ?

Best Solution

Web services are by nature stateless. Any attempt to maintain state is a hack, since you may hold something that will be used by the next request from the user, which will never come.

If you really need it, just keep it in session. For larger data sets, keep them out of session, but add session listener to cleanup that data when session expires.