B4J Question Questions about sessions

Discussion in 'B4J Questions' started by dar2o3, Mar 5, 2015.

  1. dar2o3

    dar2o3 Active Member Licensed User

    Hi all, I'm making an app you need to do things against a server created with B4J, each time the app needs such update data in the db server what I do is create a new session on the server, as if I loguin again, not because it is the time that can elapse since the last connection to the server app, if not the most correct and the B4J server (jetty) automatically cancels the previous session if it still exists or create a new.

    Sorry for my English.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    I'm sorry but I'm not sure that I correctly understand the question.

    Do you want to use a new session for each request? In that case don't use sessions at all. The purpose of sessions is to store data in the server related to a "user" instead of one specific request.
     
  3. dar2o3

    dar2o3 Active Member Licensed User

    each time a user logs in, I keep as session variable user id, for some tasks I need to retrieve the user id stored in the session to perform some queries to bd as not if the session on the server expired or no, I think the session again, is not that correct?

    thank you very much.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    You call req.GetSession to get the session. The session will not expire unless you explicitly call invalidate or set MaxActiveInterval.
     
    dar2o3 likes this.
  5. dar2o3

    dar2o3 Active Member Licensed User

    Ok, muchas gracias. :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice