I'm making a twitter corpus of my own. I've exposed the querying of the twitter corpus as a REST API using Java Servlets. However, when I do a search using the REST API all the results (>1000) are returned in one HTTP response and it takes a while to download.
I am planning to add pagination to the search like the Twitter API. For example,
http://search.twitter.com/search.json?q=blue%20angels&page=1&rpp=50
http://search.twitter.com/search.json?q=blue%20angels&page=2&rpp=50
Here rpp is results per page. So in request 1 you can the first 50 results, request fetches the next page with 50 results.
Any suggestions on how this can be done in Java servlets? Right now its very slow since the HTTP response gets huge..