Must call removeAttribute before calling getSession, otherwise it will
just find the old one:
Session.unset();
getApplication().getSessionStore().removeAttribute(getRequest(),
Session.SESSION_ATTRIBUTE_NAME); //!!
getApplication().getSessionStore().setAttribute(getRequest(),
Session.SESSION_ATTRIBUTE_NAME, getSession());
try {
sessionField.set(getRequestCycle(), getSession());
} catch (Exception e) {
throw new RuntimeException(e);
}
2009/2/22 Martin Makundi <[email protected]>:
> Further investigation shows that the wap device is very sensitive to
> switching session id on the fly. This might be because it probably
> uses url-rewriting AND it does not allow redirect, so it will easily
> trigger into wrong session (if changed on the fly).
>
> Therefore, I changed my old login session swap:
> Session.unset();
> getApplication().getSessionStore().removeAttribute(getRequest(),
> Session.SESSION_ATTRIBUTE_NAME);
> getSession().replaceSession();
>
>
> into this one:
> Session.unset();
> getApplication().getSessionStore().setAttribute(getRequest(),
> Session.SESSION_ATTRIBUTE_NAME, getSession());
> try {
> sessionField.set(getRequestCycle(), getSession());
> } catch (Exception e) {
> throw new RuntimeException(e);
> }
>
> It is a bit of a hack, though, but this preserves the client session id.
>
> And it appears to work better now. Maybe there is a smoother way to
> force new session id without dazzling the wap device?
>
> **
> Martin
>
> 2009/2/22 Martin Makundi <[email protected]>:
>> I am experiencing serious problems with the redirects.. sometimes I
>> can browse fine, but at other times the session is abruptedly
>> terminated when the wap device fails to handle the redirect.
>>
>> Did you experience any of these problems, what was your solution?
>>
>> **
>> Martin
>>
>> 2009/2/20 Jeremy Thomerson <[email protected]>:
>>> Yes - that should work.
>>>
>>> On Thu, Feb 19, 2009 at 5:47 PM, Martin Makundi <
>>> [email protected]> wrote:
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]