Check if the connection is lost from the server.

Discussion in 'Java' started by Sergio Juan, Oct 24, 2003.

  1. Sergio Juan

    Sergio Juan Guest

    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.
     
    Sergio Juan, Oct 24, 2003
    #1
    1. Advertising

  2. Hi Sergio,

    "Sergio Juan" <> wrote in message news:<fE7mb.540347$>...
    > 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
     
    Gyoergy Magoss, Oct 29, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason
    Replies:
    1
    Views:
    3,812
    Latha Rajeev
    Jun 25, 2003
  2. Bassel Tabbara [MSFT]

    RE: The transport lost its connection to the server

    Bassel Tabbara [MSFT], Jun 27, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    688
    Bassel Tabbara [MSFT]
    Jun 27, 2003
  3. =?Utf-8?B?QVNQIERldmVsb3Blcg==?=

    Spell check is lost when using ContentType = "application/word"

    =?Utf-8?B?QVNQIERldmVsb3Blcg==?=, Dec 28, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,788
    =?Utf-8?B?QVNQIERldmVsb3Blcg==?=
    Dec 28, 2005
  4. Phil Johnson
    Replies:
    3
    Views:
    995
    Phil Johnson
    Apr 9, 2008
  5. Eric Schwartz
    Replies:
    2
    Views:
    261
    Robert Klemme
    Sep 15, 2004
Loading...

Share This Page