We have a really long process an we want to trigger that progress with a webscript's endpoint
But because it is too long with too many steps, we want to write in the body the steps accomplished and I want them to be display into the client browser meanwhile the are created.
I tried flushing the outputStream, but that doesn't render the output into the browser inmediatly. The browser waits until all the steps finish for displaying the output
public class ProgressiveProcessWebscript implements AbstractWebScript
public final void execute(WebScriptRequest request,
WebScriptResponse response) {
...
response.setContentType(MIMETYPE_TXT);
OutputStream output = response.getOutputStream();
FilterOutputStream filterOutputStream = new FilterOutputStream(output);
for (Step step: stepList) {
step.execute();
filterOutputStream.write(step.getName().getBytes());
filterOutputStream.flush();
}
WebScriptResponse