Re: How to invalidate session after panel replacement?

2010-12-11 Thread bht
Thanks Ernesto.

It is doable without JavaScript:

WebRequestCycle requestCycle = (WebRequestCycle) RequestCycle.get();
WebRequest webRequest = (WebRequest) requestCycle.getRequest();
HttpServletRequest httpServletRequest =
webRequest.getHttpServletRequest();
httpServletRequest.getSession().setMaxInactiveInterval(5);

It is not perfect, and I thought that Wicket, depending so heavily on
the session, would provide a means to destroy it after use.

Regards,

Bernard


On Fri, 10 Dec 2010 11:08:58 +0100, you wrote:

>Bernard,
>
>There was someone asking something similar a few day ago... One idea
>that might work is
>
>-Put an ajax behavior on your page (AbstractDefaultAjaxBehavior) and
>use it to generate a callback url.
>-Use a non wicket AJAX (e.g. jquery AJAX) to call this behavior.
>-Make your panel call back this behavior when it is loaded. E.g make
>it implement IHeaderContributor and on
>
>public void renderHead(IHeaderResponse response)
>{
>   response.renderOnDomReadyJavascript("Put your AJAX call here!");
>}
>I think you can't use wicket AJAX because it will redirect you if you
>invalidate the session.
> -On the AbstractDefaultAjaxBehavior.respond(AjaxRequestTarget target)
>invalidate your session.
>
>Regards.
>
>Ernesto
>
>
>On Fri, Dec 10, 2010 at 9:47 AM,   wrote:
>> Hi,
>>
>> I need to invalidate the web session after a panel of the current page
>> is replaced.
>>
>> All my attempts are failing because webSession.invalidate() or even
>> webSession.replaceSession(); have an influence on the current
>> request/response.
>>
>> Typically, one would just show a new page, e.g.
>>
>> Session.invalidate();
>> setResponsePage(...);
>>
>> but I don't have this option.
>>
>> Is there any hook that I can use to expire the session after the work
>> on the current page is done? It is quite tricky because the page that
>> is loaded back into the browser with redirect after post needs the
>> session to replace the panel.
>>
>> I have tried this but it doesn't work:
>>
>> replacedPanel.getPage().add(new AbstractBehavior(){
>>    private boolean lastTime = false;
>>   �...@override
>>    public void detach(Component component) {
>>        super.detach(component);
>>        if(lastTime){
>>            AuthenticatedWebSession webSession =
>> (AuthenticatedWebSession)Session.get();
>>            webSession.replaceSession();
>>        }else{
>>            lastTime = true;
>>        }
>>    }
>> });
>> replacedPanel.replaceWith(newPanel);
>>
>> Many thanks,
>>
>> Bernard
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>-
>To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>For additional commands, e-mail: users-h...@wicket.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to invalidate session after panel replacement?

2010-12-10 Thread Ernesto Reinaldo Barreiro
Bernard,

There was someone asking something similar a few day ago... One idea
that might work is

-Put an ajax behavior on your page (AbstractDefaultAjaxBehavior) and
use it to generate a callback url.
-Use a non wicket AJAX (e.g. jquery AJAX) to call this behavior.
-Make your panel call back this behavior when it is loaded. E.g make
it implement IHeaderContributor and on

public void renderHead(IHeaderResponse response)
{
response.renderOnDomReadyJavascript("Put your AJAX call here!");
}
I think you can't use wicket AJAX because it will redirect you if you
invalidate the session.
 -On the AbstractDefaultAjaxBehavior.respond(AjaxRequestTarget target)
invalidate your session.

Regards.

Ernesto


On Fri, Dec 10, 2010 at 9:47 AM,   wrote:
> Hi,
>
> I need to invalidate the web session after a panel of the current page
> is replaced.
>
> All my attempts are failing because webSession.invalidate() or even
> webSession.replaceSession(); have an influence on the current
> request/response.
>
> Typically, one would just show a new page, e.g.
>
> Session.invalidate();
> setResponsePage(...);
>
> but I don't have this option.
>
> Is there any hook that I can use to expire the session after the work
> on the current page is done? It is quite tricky because the page that
> is loaded back into the browser with redirect after post needs the
> session to replace the panel.
>
> I have tried this but it doesn't work:
>
> replacedPanel.getPage().add(new AbstractBehavior(){
>    private boolean lastTime = false;
>   �...@override
>    public void detach(Component component) {
>        super.detach(component);
>        if(lastTime){
>            AuthenticatedWebSession webSession =
> (AuthenticatedWebSession)Session.get();
>            webSession.replaceSession();
>        }else{
>            lastTime = true;
>        }
>    }
> });
> replacedPanel.replaceWith(newPanel);
>
> Many thanks,
>
> Bernard
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



How to invalidate session after panel replacement?

2010-12-10 Thread bht
Hi,

I need to invalidate the web session after a panel of the current page
is replaced.

All my attempts are failing because webSession.invalidate() or even
webSession.replaceSession(); have an influence on the current
request/response.

Typically, one would just show a new page, e.g.

Session.invalidate();
setResponsePage(...);

but I don't have this option.

Is there any hook that I can use to expire the session after the work
on the current page is done? It is quite tricky because the page that
is loaded back into the browser with redirect after post needs the
session to replace the panel.

I have tried this but it doesn't work:

replacedPanel.getPage().add(new AbstractBehavior(){
private boolean lastTime = false;
@Override
public void detach(Component component) {
super.detach(component);
if(lastTime){
AuthenticatedWebSession webSession =
(AuthenticatedWebSession)Session.get();
webSession.replaceSession();
}else{
lastTime = true;
}
}
});
replacedPanel.replaceWith(newPanel);

Many thanks,

Bernard


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org