Reputation: 1262
I have a Play! framework (2.3.7) application that has several routes:
/api/set_x
/api/set_y
/api/set_z
/api/launch
Each one of these calls sets a property in an instance of MyObject
.
When /api/launch
is called, the instance of MyObject
is validated and if everything is ok it will be persisted and 200 OK will be returned to the user.
How to I keep the state of the instance across multiple calls until /api/launch
is called?
/api/launch
the cache was evicted and a bad request instead of OK will be returned to the user.Is there an elegant way to implement such a thing in Play?
Upvotes: 0
Views: 422
Reputation: 14401
There's no the best solution for your problem and it mostly depends on a specific use case. To keep data between requests you have three possible options:
One of the main feature of Play framework is being stateless on a server side and that should be always in mind while designing an application. So if you are looking for an 'elegant' solution the answer is simple - there's no such. It's all up to a specific case.
Upvotes: 1