Java – managing state in restful based applications
We are evaluating technologies for Web - based applications, and some suggestions are to adopt a restful service approach
1) Spring 2) Apache CXF (jax-rs)
My question is
1) How to manage status between requests For example, the user has been authenticated, and now he is sending a series of requests for us to report through paging I think this will be such a URL
domain. com/reports/customreport/page/1 domain. COM / reports / customreport / page / 2, etc
a) User information & stores request parameters so that they can be shared between requests b) Let's say that the result is streaming. Where is rowset stored?
Is there a complete sample application like petclinic that can provide best practices for such applications
Solution
If you are performing restful strictly / correctly, user authentication will be performed in each request, and there is no concept of session Each request contains enough context information (in the URL and / or request parameters) to make it work independently of the session
It must be managed by the customer
User authentication information is stored by the client and provided to the server with each request The server recalculates any derived information about the user on each request Generally, any request parameters stored in the server - side "session" must be retransmitted with each request
At the first moment, there was nowhere to go Each time you use parameters to specify the location to jump to, reissue the query If performance is a problem, you can
>Pre read several pages of the result set and store them in the server-side cache, or > adjust the database query cache of the query