Check if the connection is lost from the server.

S

Sergio Juan

Hi.

I have an applet that opens a connection to the server (URLConnection to a
jsp). The jsp invoked starts creating files and, each time one is created,
writes its name back to the applet so it can make the browser go and
download it. This all has works fine.

The trouble is that I want that, if the applet is destroyed (for example,
the window is closed), the back-end jsp stops generating files (it is a
heavy duty). I expected that, when the applet was gone, an IOException would
be thrown when the jsp writes the next file's name (it is allways followed
by a flush()), but that does not happen and the jsp keeps working until its
normal termination.

Any ideas? I'm using Weblogic5.1 as server, with JDK1.3.1

Thanks In advance. Sergio.
 
G

Gyoergy Magoss

Hi Sergio,

Sergio Juan said:
Hi.

I have an applet that opens a connection to the server (URLConnection to a
jsp). The jsp invoked starts creating files and, each time one is created,
writes its name back to the applet so it can make the browser go and
download it. This all has works fine.

The trouble is that I want that, if the applet is destroyed (for example,
the window is closed), the back-end jsp stops generating files (it is a
heavy duty). I expected that, when the applet was gone, an IOException would
be thrown when the jsp writes the next file's name (it is allways followed
by a flush()), but that does not happen and the jsp keeps working until its
normal termination.

Any ideas? I'm using Weblogic5.1 as server, with JDK1.3.1
I do not have a server specific solution. Since you are using an
applet, there is some sort of session (i.e. any request sent by the
applet can be identified by a session id given by the WebServer or
ApplicationServer.)
I would generate an entry in the session hashtable (setAttribute()) in
the beginning of the process. Your back-end jsps should than check for
the existence of this semaphore every time before a file is generated.
The destroy method could then send another request to (if you want
another) a servlet,that removes the entry from the session hashtable
(removeAttribute()). Your JSP would than not any longer generate the
files.
That should work....
Thanks In advance. Sergio.

Regards

Gyoergy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top