Redirect and remove current session

asked 2016-12-14 14:29:33 +0800

FlorianSchaetz gravatar image FlorianSchaetz flag of Germany
31 6

updated 2016-12-14 14:33:49 +0800


perhaps someone got an idea: How can I force ZK to remove the current session and load a page (on the same server/domain) with a new one? I store a lot of data in the session and keeping it there when loading the new page would effectively pollute that new page, so I'm looking for a way to "redirectAndForgetSession"...

Calling invalidate() on the session and then sendRedirect in a click-listener doesn't work.

Little detail: I use session identification via url (single-page-application, iframe, cross-domain... long story) and so the resulting url I get for the redirect looks like /index.zul;jsessionid=... - when removing that jsessionid manually from the link, it works, but I cannot stop ZK from adding it automatically. Preventing that could solve my problem as well.



delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-12-14 17:47:17 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9

Hey Flo,

Maybe some easier solution is there.

Put in your session a Map<String,Object> as object.
Then store all the "pollution" data in there.

Calling new page => just put a new Map into the session or clear the map and your done.
Saves also all the code of invalidating and recreating a new Session.

Greetz chill.

link publish delete flag offensive edit


Sounds like a great idea in any case, thanks, will do.

FlorianSchaetz ( 2016-12-14 18:11:58 +0800 )edit

answered 2016-12-14 18:11:37 +0800

FlorianSchaetz gravatar image FlorianSchaetz flag of Germany
31 6

Ok, found one solution myself: When using an absolute link ( http://...) instead of a relative one ( /... ), ZK doesn't seem to attach the jsessionid to it, which pretty much solves my problem since without the jsessionid nothing bad happens.

link publish delete flag offensive 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: 2016-12-14 14:29:33 +0800

Seen: 36 times

Last updated: Dec 14 '16

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