Title: RE: send response to browser and continue processing in servlet.s ervice()

One way you can set the refresh header which auto checks for every 5 secs or 10 etc and displays the new data. This way once the data is fully there then do not set the refresh header and just send the data in your servlet. This way part of the servlet result can be displayed and rest as and when it comes.

Thanks and Regards,

===
Gary Grewal


-----Original Message-----
From: William Kaufman [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 07, 2001 3:17 PM
To: '[EMAIL PROTECTED]'
Subject: RE: send response to browser and continue processing in
servlet.s ervice()


> I tried SevletResponse.getOutputStream().flush() which will
> send all output
> to the browser. However, the browser's indicator keep on spinning.

Is that a bad thing?

That is, when you're off working on something else, is the page finished or
isn't it? 

If it is finished, you can close the output stream, and do the work in
another thread.  If it isn't finished (i.e., if the work you're doing has to
return to the browser's page), then the browser _should_ seem busy, because
it's waiting on more data.

(Any other solution to this, including launching more browser windows or
refreshing the page constantly for extra data, will be solved with
HTML/HTTP, and won't be specific to Tomcat, to servlets, or even to any Java
code.  You can try looking around HTML web sites, like html.about.com or
www.webdeveloper.com .)

                                                            -- Bill K.


> -----Original Message-----
> From: Wai-Yip Tung [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 07, 2001 12:20 PM
> To: [EMAIL PROTECTED]
> Subject: send response to browser and continue processing in
> servlet.service()
>
>
> Is there a way to send the response to browser and then continue some
> lengthy processing in the Servlet.service() method? I'm using
> IE and I tried
> these scenarios.
>
> I tried SevletResponse.flushBuffer() which seems to have not effect.
> I tried SevletResponse.getOutputStream().flush() which will
> send all output
> to the browser. However, the browser's indicator keep on spinning.
> I tried SevletResponse.getOutputStream().close() also but it
> also seems to
> have no effect.
>
> The indicator won't stop until I exit Servlet.service().
>
> Because of my design, I can't just start a thread and exit.
> Is there anyway
> I can tell Tomcat I want to remain in Servlet.service() for a
> while. All
> output has been send and please close the socket?
>
> Thanks for any help!
>
> Wai-yip
>
>
>
>

Reply via email to