Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23055 > unrolled thread
| Started by | "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> |
|---|---|
| First post | 2013-03-21 22:27 -0700 |
| Last post | 2013-03-22 18:27 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
sharing sessions between 2 different requests "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> - 2013-03-21 22:27 -0700
Re: sharing sessions between 2 different requests Arne Vajhøj <arne@vajhoej.dk> - 2013-03-22 18:51 -0400
Re: sharing sessions between 2 different requests Roedy Green <see_website@mindprod.com.invalid> - 2013-03-22 18:27 -0700
| From | "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> |
|---|---|
| Date | 2013-03-21 22:27 -0700 |
| Subject | sharing sessions between 2 different requests |
| Message-ID | <7a1ba066-5e1d-4f48-9db4-e2768020a7f9@googlegroups.com> |
I have a situation where a servlet is passed an different session then the one it should be using (the one it should be using is passed as a var "id") how do I make it so the session the servlet (or jsp) uses is the one in the var and not in the passed session ideally I want something like this: <% session=SessionUtil.findSession(id); %> where SessionUtil is either prexisting or something I make my self. Just in case people want to know the background see the other thread on JNLP sessions (I made it so I can pass the orginal session ID now but have no idea how to rejoin the two sessions)
[toc] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2013-03-22 18:51 -0400 |
| Message-ID | <514ce06d$0$32109$14726298@news.sunsite.dk> |
| In reply to | #23055 |
On 3/22/2013 1:27 AM, Aryeh M. Friedman wrote: > I have a situation where a servlet is passed an different session > then the one it should be using (the one it should be using is passed > as a var "id") how do I make it so the session the servlet (or jsp) > uses is the one in the var and not in the passed session ideally I > want something like this: > > <% session=SessionUtil.findSession(id); %> > > where SessionUtil is either prexisting or something I make my self. Any solution to this will probably be a bit tricky, but here is my suggestion: - define a HTTP session listener - let that maintain a data structure where all sessions are stored - never store anything directly in session instead store everything in a (Hash)Map stored in the session - when the second session has to be made "ready" you copy the ref to that (Hash)Map from the first session to the second second (the first session is found via the data structure in first item) Arne
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2013-03-22 18:27 -0700 |
| Message-ID | <u31qk89f83l9on2qc3r9k1das4v9hbi0v0@4ax.com> |
| In reply to | #23055 |
On Thu, 21 Mar 2013 22:27:46 -0700 (PDT), "Aryeh M. Friedman" <Aryeh.Friedman@gmail.com> wrote, quoted or indirectly quoted someone who said : > session=3DSessionUtil.findSession(id); Can't you use a reference to the session itself? Can you build a HashMap of id to session every time you see an ID, perhaps a WeakHashMap. -- Roedy Green Canadian Mind Products http://mindprod.com Every method you use to prevent or find bugs leaves a residue of subtler bugs against which those methods are ineffectual. ~ Bruce Beizer Pesticide Paradox
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web