File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes RESTful Web service with JAX-RS - pagination and caching Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "RESTful Web service with JAX-RS - pagination and caching" Watch "RESTful Web service with JAX-RS - pagination and caching" New topic
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: RESTful Web service with JAX-RS - pagination and caching
 
Similar Threads
pagination
pagination in jsp
Pagination using the database(DB2)
Pagination
Pagination