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

How many sessions/app - Timeout - question?

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the number of sessions per application per user?
As many as the application wants....
Say, one session for the Books section of an online store, another session for the electronics section of the store. Is that possible?
If it is possible to have different sessions, can they have different timeouts for different sessions of the application?
Just curious....thinking out loud....Don't ask me what advantages it has.... :roll:
Thanks.
- satya
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I say:
One session per user per app. Not more.
As you know sessions are realized as a cookie or an url. Both are valid for the whole application.
Axel
 
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I have not really thought about this question in detail, but let's say state management is done using cookies.
I open IE and come in, leave it open.
Then I open Netscape and come in, leave it open.
Then I open Opera and come in, ....
Then I open XYZ browser, .... you get the idea.
So what sort of session management is required by the app?
Just some possible problems for which I do not have a solution.
Regards, Guy
 
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
Guy:
Each browser will have its own session object, as I understand.
Axel:
I agree that one session per user per application is the way to go.
My curiosity is from a theoritical perspective...Does the API/Spec stop me from doing what I said. I don't think the API or Spec stops us from doing this.
What do you think?
The real question I want to ask is......
Can I have a 10 session in one part of my store and a 60 min session in another part of my store?
Thanks.
- satya
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Madhav Lakkapragada:

My curiosity is from a theoritical perspective...Does the API/Spec stop me from doing what I said. I don't think the API or Spec stops us from doing this.
What do you think?
The real question I want to ask is......
Can I have a 10 session in one part of my store and a 60 min session in another part of my store?
Thanks.
- satya


Satya,
with what code do you want to implement your functionality
We get the session with

Originally posted by api-doc:

public HttpSession getSession(boolean create)Returns the current HttpSession associated with this request or, if if there is no current session and create is true, returns a new session.


So if there is still a session-cookie for that app in the request of the user, you will get that session and if not it will create a new session.
To implement your idea in my understanding one would have to use some method like:
public HttpSession getSession(boolean create, String urlPattern)
But this does not exist.
Axel
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i think we can do something satya wants. not by using Session object though and maintaining our own objects (which i will refer to OurSession) in the Context. we can have a Map of OurSession Objects and the URL of parts to which it corresponds with this URL being the Key field. thus we can achieve the objective.
now, as far as the session timeout goes, thats a difficult part if we have to do it on our own but still we can do that using Timer and TimerTask classes. we can associate different Timers with various OurSession objects.
i am not sure of consequences and difficulties we may face here as never done this.
enhancements are well-come to this idea!
regards
maulin.
 
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
As I said, I was just thinking out loud.....I agree with you guys that we have only one session.
- satya
 
I don't even know how to spell CIA. But this tiny ad does:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic