> ----------
> From:         Sudarson_Pratihar
> Sent:         Monday, April 30, 2001 10:39 AM
> To:   'A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology.'
> Subject:      RE: How to detect browser stop -- it is possible!
>
> yeah, 'm using the server push technique as it is used in pushlet, but
> messaging portion I 'm managing thru JMS not thru their framework. That is
> when have the problem of servlet instances alive when browser is stopped.
>
> ----------
> From:         Tarun Ramakrishna Elankath[SMTP:[EMAIL PROTECTED]]
> Reply To:     A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology.
> Sent:         Monday, April 30, 2001 8:45 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: How to detect browser stop -- it is possible!
>
> I think you have only two options in this kind of situation :
>
> 1) Let the browser contain an applet that communicates with the server.
> The
> applet unlike the browser window is outside the "purview" of the stop
> button
> of the browser.The applet can
>     a) open a new frame (AWT) that displays the information that the
> server
> has pushed
>     b) Using LiveConnect, the applet opens a new browser window (through
> javascript) and writes to that window (only possible in Netscape)
>
> 2) Send events from servlets to DHTML client browsers :
> see JavaWorld article
> http://www.javaworld.com/javaworld/jw-03-2000/jw-03-pushlet.html
> ----- Original Message -----
> From: "Sudarson_Pratihar" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, April 29, 2001 5:14 PM
> Subject: Re: How to detect browser stop -- it is possible!
>
>
> > Hi,
> >
> > Really thanks for taking interest.
> >
> > What my intension is that I want to develop a servlet based application
> > which will update the browser view as and when the system get some input
> > data comes to the server(may be coming to the server thru real time
> input).
> >
> > For that, I'm using JMS and in the serverlet , I'm not clsoing the
> socket
> > i.e. servelet is waiting for the message. When some JMS message comes to
> the
> > servlet, the browser view is updated thru  server push mechanism.
> >
> > But the problem is that when a browser stop button being pressed leaves
> the
> > listener object still alive and that is of major concern.
> >
> > This is the senario. I have also doing experiment with IOException
> raised
> by
> > the servletoutputstream.flush(). But still wanting more effective
> solution.
> >
> > Thanks and Regards,
> > Sudarson
> >
> > > ----------
> > > From:         Tarun Ramakrishna Elankath[SMTP:[EMAIL PROTECTED]]
> > > Reply To:     A mailing list for discussion about Sun Microsystem's
> Java
> > > Servlet API Technology.
> > > Sent:         Saturday, April 28, 2001 8:43 PM
> > > To:   [EMAIL PROTECTED]
> > > Subject:      Re: How to detect browser stop -- it is possible!
> > >
> > > Hmm... (brain ticking)
> > >     When you press the stop button on a browser, chances are that the
> > > browser has already send a request to a server and is waiting for a
> > > response. Ofcourse you could also have pressed the stop button when
> the
> > > browser is still issuing a request, but  the time required for issuing
> a
> > > request is much greater than the time required for waiting for the
> > > response.
> > > (unless you have some huge POST data) .
> > >     So the maximum that you could hope for is that the servlet throws
> an
> > > IOException when writing to the output stream. And then hope that the
> > > exception was thrown because the client clicked the stop button. This
> is
> > > loony logic because this IOException could be thrown for other reasons
> as
> > > well, such as the connection getting lost or timed out.
> > >     I really dont believe that you could detect the stop button being
> > > clicked. There is no event handler in JavaScript that detects the stop
> > > button being clicked. (for very good reasons : - which is the script
> that
> > > should detect it ? the one that got unloaded or the one that is
> loading
> ?)
> > >     You could get around this with some convoluted Javascript hacks
> that
> I
> > > do not recommend.  One such tactic is
> > > that you could open a window with no stop buttons at all (and disable
> the
> > > hot keys) so that the only way the user can stop the page from loading
> is
> > > to
> > > close the window.
> > >     Another would be to have a hidden frameset in each page (width &
> > > height
> > > =0) which has a script that monitors the activity of the links in the
> > > visible frameset, and checks that the link that was clicked on was
> loaded.
> > > This solution is more in the realm of DHTML than servlets and doesnt
> serve
> > > much purpose apart from making simple things complicated.
> > >    About the cleaning up work,  it depends on what volume of data you
> > > happen
> > > to have associated for each user session. You can either set timeout
> > > intervals for sessions or if you are reasonably sure that the client
> has
> > > terminated his/her session, you could manually get rid of the data
> > > yourself.
> > >     You cannot "destroy" objects that are created within the servlets.
> At
> > > maximum, you can set their references to null and hope that the
> garbage
> > > collector collects them. If you are planning to destroy instance
> objects,
> > > then thats dangerous, because an instance of a servlet could be
> assigned
> > > multiple requests in different threads (unless you are using the
> > > SingleThreadedModel)
> > >     I am actually quite confused as to what are you trying to do.
> Could
> > > you
> > > give a brief explanation of what are you trying to achieve ? Maybe we
> can
> > > accomplish it another way.
> > >
> > > ----- Original Message -----
> > > From: "Sudarson_Pratihar" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Saturday, April 28, 2001 3:42 PM
> > > Subject: Re: How to detect browser stop -- it is possible!
> > >
> > >
> > > > Thanks for the reply. But what you have talked about the Browser
> closing
> > > ,
> > > > I'm talking about the stop button(or interrupt) button of browser.
> > > > Is that applicable for that also?
> > > >
> > > > And if so, how can I destroy the objects that are created within the
> > > > particular servlet.
> > > >
> > > > Pls highlight on the clean up work.
> > > >
> > > > Regards,
> > > > Sudarson
> > > >
> > > >
> > > > > ----------
> > > > > From:         Tarun Ramakrishna Elankath[SMTP:[EMAIL PROTECTED]]
> > > > > Reply To:     A mailing list for discussion about Sun
> Microsystem's
> > > Java
> > > > > Servlet API Technology.
> > > > > Sent:         Friday, April 27, 2001 8:36 PM
> > > > > To:   [EMAIL PROTECTED]
> > > > > Subject:      Re: How to detect browser stop -- it is possible!
> > > > >
> > > > > Well IT IS actually possible for the browser to inform the server
> that
> > > it
> > > > > has been closed.! You would have to do the scripting via
> JavaScript
> > > > > though.
> > > > > You could set a onunload() event handler for the window. This
> onunload
> > > > > event
> > > > > handler could then call a server-side script with the parameter
> > > > > close=true.
> > > > > The server-side script could then use this information to perform
> > > > > some-clean
> > > > > up operations. However the sever-side script SHOULD NOT write to
> the
> > > > > client,
> > > > > because by that time IE/NS would have closed the window down.
> > > > >
> > > > > A rough outline of how this works is like follows :
> > > > >
> > > > >   <script language="javascript">
> > > > >    window.onunload = function() {
> > > > >         location.href="detect_close.jsp?close=true";
> > > > >    }
> > > > >   </script>
> > > > >
> > > > > You could do whatever you want in the JSP. Note that the JSP WILL
> KNOW
> > > > > which
> > > > > client has shut the window, because the browser would send the
> > > > > session/cookie data in the request just before the window shuts
> down.
>
>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to