| Author |
RESTful Web service with JAX-RS - pagination and caching
|
Hervé Guidetti
Greenhorn
Joined: Apr 20, 2006
Posts: 3
|
|
Hi all,
I'm planning to develop a REST Web service using JAX-RS.
I have a core banking system that gives me a list of entries (I cannot change it).
Pagination : I would like to be able to get the list of entries (example 400 entries) and send some of them to the web service client. When I ask the web service for the first time (for the first page), the entries are retrieved from the core banking system, cache them somewhere, and return the 10 first entries. When I ask the second page, I would like to retrieve the 400 entries from the cache and return the next set of 10 entries (next page).
My question is : where should I put this cache ?
Is it OK to use the HttpSession since RESTful web service should be stateless ?
What would you advice otherwise ?
Thanks in advance for your advices.
Hervé
|
 |
michael cheung
Greenhorn
Joined: Apr 13, 2009
Posts: 3
|
|
|
Restful api is stateless. (http://en.wikipedia.org/wiki/Representational_State_Transfer) You shouldn't use http session to store the state. You can do caching, but that should done in a distributed cache. The way i do pagination is doing through using a query parameter or header passing the page number and size. Hope this help.
|
 |
 |
|
|
subject: RESTful Web service with JAX-RS - pagination and caching
|
|
|