Is there a way to access variables across sessions?

asked 2014-02-11 04:46:59 +0800

dormitionskete gravatar image dormitionskete
5 1

I know can store session variables, and retrieve them like this:

// Store
Session sess = Sessions.getCurrent();
sess.setAttribute("Login.Redirect", "/myaccount/myaccount.zul");

// Retrieve
String sLoginRedirect = (String) sess.getAttribute("Login.Redirect");

Is there any way to do this across sessions?

I'm writing an ecommerce application, and I'd like the user to be able to browse the site using http. When they log in, or go to check out, I'd like it to connect to a secure server. My servers will have different names. When the application switches from www.mysite.com to secure.mysite.com, for example, it starts a different session.

I'd like to pass a unique identifier from one session to the other. I know I can do that with either a cookie, or as a parameter in the URL. Is there any other way to do this -- preferably something more elegant, like the session attributes?

Any help or advice would be greatly appreciated!

Nico Metsovon

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2014-02-11 06:51:08 +0800

chillworld gravatar image chillworld flag of Belgium
5357 4 9

updated 2014-02-12 19:07:52 +0800

If you need it across sessions, it will be no longer an session variable but more an application variable right? Session is ment to be just there for the session and not available for other sessions. Application is higher and each session can reach that variable.

For Desktop attributes :

Object o = Desktop.getAttribute(String attributeName);

See here for doc Desktop

For application :

WebbApp webapp = Desktop.getWebApp();
Object o = webApp.getAttribute(String attributeName);

See here for doc WebApp

For the 2 this is of course also available :

setAttribute(java.lang.String name, java.lang.Object value)

Greetz chill.

link publish delete flag offensive edit

answered 2014-02-12 17:58:18 +0800

dormitionskete gravatar image dormitionskete
5 1

I tried to reply to this twice yesterday, but neither reply ever showed up. We'll try it again today...

Yes. You are quite right. What I am asking is, "Is there a way to do something like the session variables at a higher level, such as the Desktop or Application level?"

I've looked and looked, but have not found such a way. Does anyone else know of a way to do this?

Any help will be appreciated!

link publish delete flag offensive edit


updated answer.

chillworld ( 2014-02-12 19:08:28 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2014-02-11 04:46:59 +0800

Seen: 29 times

Last updated: Feb 12 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More