• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What happen when applet browser is closed?

 
SoonAnn Lim
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing an applet that do nothing but will keep track total time the window is opened. I do a http get request in applet's destroy()/stop() method to check in with a servlet about its closing time. When applet is reload(), this process is completed and servlet can get the reload time. However, when the browser is closed, the get request is not transmitted because the URL.openStream() cannot succeed. Thus, i cannot open a BufferedStreamReader to read the reponse from the server (this step is needed to complete a TCP/IP cycle). How can i make the last request successful by modifying my applet?
Here is my code snippet.
<code>
/********************************/
try{
URL url = new URL(url_to_servlet);
BufferedReader bf = new BufferedReader(
new InputStreamReader(
url.openStream()));
//This readLine() is needed to complete a request.
String temp = bf.readLine();
bf.close();
}catch(Exception e){}
/**************************************/
<code>
Can anyone help?
Regards,
[ June 27, 2002: Message edited by: SoonAnn Lim ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic