Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending large data over a java web service

I have a Java web service that returns a large amount of data. Is there a standard way to stream a response rather than trying to return a huge chunk of data at once?

like image 316
Jeff Storey Avatar asked Jan 08 '13 20:01

Jeff Storey


2 Answers

This problem is analogous to the older problem with bringing back large RSS feeds. You can do it by parameterizing the request: http://host/myservice?start=0&count=100, or by including next/prev urls in the response itself.

The latter approach has a lot of advantages. I'll search for a link that describes it and post it here if I find one.

like image 129
ccleve Avatar answered Oct 05 '22 06:10

ccleve


I would look into a comet like approach:

From WIKI:

Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it.

Basically, rather than sending the large data all at once, allow your web server to push data at its own pace and according to your needs.

like image 45
Goaler444 Avatar answered Oct 05 '22 04:10

Goaler444