streaming page results in scalatra / unfiltered

897 views Asked by At

when writing a CGI script or a basic servlet you can send part of the response to the client before the entire response has been generated. This is advantageous when, for example, performing a large SQL query and displaying the results in an HTML table. Showing the results as they come in makes the application much more responsive. Is this possible in a basic REST framework like Scalatra or Unfiltered--where the return value is often the response text?

1

There are 1 answers

0
whiter4bbit On

I think, that you talking about Chunked Transfer Encoding you need support for this encoding by servlet engine. AFAIK, Atmosphere with right backend may help you, you can try use it with scalatra. About Unfiltered, it has netty backend, I'm not sure, that chunked encoding currently supported by Unfiltered, but you can try to hack it.

P.S. You can look at example of streaming server in Unfiltered: https://github.com/n8han/All-Aboard.