Hi Matthias,
On Thu, Nov 3, 2011 at 9:30 AM, Matthias Keller
<[email protected]> wrote:
> Hi Martin
>
> I see this is getting in the same direction as it was with Wicket 1.4 - it
> just doesn't work as expected.
> The method you propose results in the next page shown as expected and going
> back is not possible anymore. But so is clicking on anything on the next
> page then - those links seem to be invalid then too...
>
> The problem seems to be in the order of events:
> 1) The flow wishes to invalidate all current pages, so calls Session.clear()
> 2) Then the user is redirected to a new page with setResponsePage(new
> NextPage())
> 3) Then the request ends and if cleaning up is performed at this stage, it
> doesn't know to keep the NextPage and its links but clean everything else
>
> No 3 could be addressed in wicket 1.4 using the internal untouch method to
> tell wicket NOT to store that page anymore.
One question: what should happen when the user is redirected to
NextPage (because of setResponsePage(new NextPage())) and
the user clicks on a Link ?
Wicket will try to find the page to execute Link#onClick() but since
the page is not stored Wicket will throw PageExpiredException.
The same will happen if the user refreshes the page with F5.
How do you handle that case ?
Session.clear() removes all pages stored so far. If you use
setResponsePage(anInstance) then a new page will be stored afterwards.
If you really want to clear all pages even the NextPage instance then
you can do:
class MyRequestCycle extends RequestCycle {
private boolean fullClean;
public void fullClean() {
fullClean = true;
}
@Override
public void detach() {
super.detach();
if (fullClean) {
fullClean = false;
Session.get().clean();
}
}
}
>
> What appears to work is create a public method in my session which calls:
> getSessionStore().invalidate(RequestCycle.get().getRequest());
>
> This seems to work (and is part of what replaceSession() does) but I don't
> know the internals of the new PageManager et al so I'm not sure if this is
> already enough and correct?
>
> Matt
>
> On 2011-11-02 13:27, Martin Grigorov wrote:
>>
>> On Wed, Nov 2, 2011 at 2:09 PM, Matthias Keller
>> <[email protected]> wrote:
>>>
>>> Hi Martin
>>>
>>> Thanks for the quick reply.
>>> The fix doesn't work for me though, I can still go back and press reload
>>> or
>>> do anything I like.
>>> If I use session.replaceSession() it works as expected but as a side
>>> effect
>>> also changes the JSESSIONID which usually isn't what you want...
>>>
>>> I'm using it like that in an onClick event of a button (and the session
>>> is
>>> NOT temporary):
>>>
>>> if (getSession().isTemporary() == false) {
>>> getSession().getPageManager().sessionExpired(getId());
>>> }
>>
>> This code does the same as in 1.4 with page maps.
>> #untouchPage() as internal API in 1.4 and is not ported to 1.5.
>>
>> Try by override Session#detach() and do:
>> super.detach();
>> clear();
>>
>>> setResponsePage(new ConfirmationPage(...));
>>>
>>> Maybe it could be some kind of special situation like it was in Wicket
>>> 1.4
>>> where I manually had to untouch the current page to avoid it still being
>>> stored at the end of the request...?
>>>
>>> Matt
>>>
>>>
>>> On 2011-11-02 10:40, Martin Grigorov wrote:
>>>>
>>>> I implemented the feature in the ticket Matt created.
>>>> Please try it.
>>>>
>>>> On Wed, Nov 2, 2011 at 11:35 AM, Andrea Del Bene<[email protected]>
>>>> wrote:
>>>>>
>>>>> Have you tried session.invalidate()? If you have an
>>>>> AuthenticatedWebSession
>>>>> you can also use signOut()
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> Upon logging out we need to keep the current user's session to still
>>>>>> display some information but we want to remove all previous pages from
>>>>>> the
>>>>>> PageMap (or however that is solved in Wicket 1.5 now) so that he
>>>>>> cannot
>>>>>> go
>>>>>> back and continue on these pages.
>>>>>> In Wicket 1.4 we found a way to achieve that, basically with
>>>>>> session.clear() (plus session.untouch(getPage()) ). In Wicket
>>>>>> 1.5.2
>>>>>> the
>>>>>> clear() method ist still there, but only contains an empty TODO
>>>>>> comment....
>>>>>>
>>>>>> How do we clear the previous pages now so that if he goes back, the
>>>>>> user
>>>>>> receives a PageExpiredError ?
>>>>>>
>>>>>> Thanks a lot
>>>>>>
>>>>>> Matt
>
>
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]