> > Sandeep Mehta wrote:
> >
> > > What I am trying to do is that there is a paid web site that allows users
> > > to enter the site after allocating him a certain time.He cannot surf beyond that 
>time limit.So far so good .I can track the session but my requirment is that if the 
>user closes his browser before the allocated time or the internet connection at his 
>end fails then I have to calculate the total time surfed by him and accordingly 
>update his account.
> > > So how do i come to know that browser has been closed or the connection at users 
>end has failed.I tried to write a thread that checks every minute
> > > if(session==null) System.out.println("logged out");but it does not work.
> > > How can the servlet or server come to know when the browser has been closed.

Ernie V wrote:
>
> There is one undeniable fact...and that is that there is no "simple" way to tell 
>wether one has left your site, or that they have quit their browser. There are 
>however, several techniques that one could employ to deal with the fact that someone 
>is no longer making requests or that someone has left your site. It all comes down to 
>how you architect your
> application.

But perhaps, Sandeep, you're asking the wrong question. How do you measure the
time that a user spends surfing your site? It sounds as though you want to
measure surf time by the amount of time between browser requests. That is, if a
user loads a page from your site, and then 1 hour later clicks a bookmark in the
browser that takes the user to another site, that the user has spent 1 hour
surfing your site.

If that is what you are attempting, then as has been noted, there is no 100%
sure way to do this. It's inherent in the HTTP protocol. The server only knows
about a browser during the time that a connection exists between the two. You
can save information about a browser/request in a session object, but
_generally_ that information has no purpose until that browser makes another
request. Sure, most (some?) of the time, if a user clicks to your site, and then
5 minutes later clicks to another site, they've spent 5 minutes reading the page
from your site. But as you noted, there are some situations where the user will
leave your site and you may not be notified.

However, in my opinion, the better thing to measure in this situation would be
actual page views. I don't think it matters that one person may spend 5 minutes
on a page and another might spend 1 hour. You've served a page of content, you
should be charging for the content, not the reading speed of the viewer. If you
charge this way, then you don't care when or if the user closes the browser or
links to some other site. (Okay, sure, there are still some problems with this
method. Just because you serve a page doesn't mean that the page gets to the
browser. But this problem also exists in your pay-for-time model.)

Kevin Mukhar

___________________________________________________________________________
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