• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What happen when applet browser is closed?

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic