E
Eoin
Hi All,
I am trying to write a servlet based web application that will
effectively pass an ever changing text string from a web server to an
applet client without the need for the client to continuously poll the
server to receive each update. Unfortunately, despite much research,
time and effort I am starting to believe that the task may be
impossible.
The key factor is that I don't want the client to poll the server to
get every update as in the final production environment, when using
SSL encryption and certificates, the performance overhead of each
request is unacceptable.
What I have tried to do is to have the applet client call the servlet
using URLConnection, then in the Service methods on the servlet
(either doPost or doGet) I block and loop, writing the changed text
string to a PrintWriter generated from the HttpServletResponse object.
What I am seeing is that the client does not receive any data back
until the doGet or doPost methods finish completely. When this
happens, the client gets all the previously written data in one go. I
have tried both the PrintWriter.flush() and
HttpServletResponse.flushBuffer() methods in-between writes but this
makes no difference.
Does any have any suggestions or is it just impossible to try and
misuse the Request/Response HTTP protocol in such a way.
Any help you can give is much appreciated.
Eoin.
p.s. When I use the HttpServletResponse.setContentLength() method to
set the content length header of the response to be that of the text
String then the client does receive the data before the doGet or
doPost methods finish but I am not then able to pass any more text
Strings back to the client.
I am trying to write a servlet based web application that will
effectively pass an ever changing text string from a web server to an
applet client without the need for the client to continuously poll the
server to receive each update. Unfortunately, despite much research,
time and effort I am starting to believe that the task may be
impossible.
The key factor is that I don't want the client to poll the server to
get every update as in the final production environment, when using
SSL encryption and certificates, the performance overhead of each
request is unacceptable.
What I have tried to do is to have the applet client call the servlet
using URLConnection, then in the Service methods on the servlet
(either doPost or doGet) I block and loop, writing the changed text
string to a PrintWriter generated from the HttpServletResponse object.
What I am seeing is that the client does not receive any data back
until the doGet or doPost methods finish completely. When this
happens, the client gets all the previously written data in one go. I
have tried both the PrintWriter.flush() and
HttpServletResponse.flushBuffer() methods in-between writes but this
makes no difference.
Does any have any suggestions or is it just impossible to try and
misuse the Request/Response HTTP protocol in such a way.
Any help you can give is much appreciated.
Eoin.
p.s. When I use the HttpServletResponse.setContentLength() method to
set the content length header of the response to be that of the text
String then the client does receive the data before the doGet or
doPost methods finish but I am not then able to pass any more text
Strings back to the client.