Low Level Streaming with JAX-RS StreamingOutput

You may also like...

Subscribe
Notify of
guest
1 Comment
Oldest
Newest
Inline Feedbacks
View all comments
Abhi
Abhi
August 20, 2021 15:21

Hi, Thanks for sharing the post. I tried small variation by adding delay in writing numbers to StreamingOutput, However the output starts printing only after all 60 numbers are written. I was expecting one number to be printed at a time. Tried the cURL but same issue.

   Writer writer = new BufferedWriter(new OutputStreamWriter(out));
        for (int i = 0; i < 60 ; i++){
          writer.write(i + ” “);
          writer.flush(); // Shifted this inside.
          try {
Thread.sleep(1000);
} catch (InterruptedException e) {
//eat up for demo purpose
}
        }

1
0
Would love your thoughts, please comment.x
()
x