• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

session timeout

 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your session times out after 30 minutes, is it 30 minutes after session is created? or 30 minutes after something else?
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
or 30 minutes after something else?
yes, it is after 30 minutes (or something else) of
inactivity. Please note it can also be inactivated
manually. The time can be tracked using the HttpSession obj.
A method getLastAccessedTime() is also supported by
this class, which returns the time at which the client last
sent a request associated with the session.
regds.
- satya
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think 30 minutes is the default in web servers.If we want can modify it
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Madhav,
That is very interesting. so theoretically at least, I could use getLastAccessedTime() to warn the user to hurry up when they are using my quiz applet. Can an applet access the session object?
I'm not real concerned about it cause I dont think many people will want to spend over 30 minutes on a quiz but I am curious.
I am glad to hear it is not 30 minutes from when the session was created

[This message has been edited by Randall Twede (edited March 10, 2001).]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can an applet access the session object?
Now I should show my ignorance on the subject......
Not very sure. Sorry!
regds.
- satya
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me know if my thinking is right on this.
An applet extends Applet and to have access to the session object you need to extend HttpServlet. In Java I don't think it is possible to extend multiple classes. So it wouldn't be possible for an applet to have a session object.
 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But I think a GetLastAccessedTime servlet can be created which accesses the session object. Then the applet can be made to access that servelet (by sending an http GET request). Thus it can retrieve the last accessed time.
But why should the applet do this at all? The applet can have a timer thread running on the client, and so it can keep track of user inactivity, without calling on the server. The applet can have a long timeOut member variable, which can be set in the init() method using getParameter("timeOut"). The timer thread can fire events whenever inactivity nears the timeOut value. The applet gui on getting timer events will flash a warning in the gui.
Of course the last accessed time for the server will be later then the last accessed time on the applet- but that should be no problem- it will give an earlier warning to the user.
Alternatively the applet, whenever it finds that user-inactivity is nearing time out period, instead of warning the user, it can make some request to the server which would reset the last accessed time. Maybe a ResetLastAccessedTimeServlet can be used for this purpose. Maybe there is some method in the api to reset the last accessed time.
Am I thinking right?
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rahul,
Both sound like good ideas. What I plan to do is limit the number of questions so that they run out and you have to click quit. This sends a request to the servlet which displays a page asking them if they want to take it again. The only "problem" there is they can get repeat questions.
I am thinking maybe an applet cant use a session object because the browser JVM doesnt have servlet API.
 
The City calls upon her steadfast protectors. Now for a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic