Thanks Alastair for your answer. I didn't know this "head" stuff, it's
quite impressive :)

However, I was willing to provide a message, so finally I ended using
Eelco solution, since with it I could easily provide some page
parameter for the message.

BTW, Eelco, since Wicket 1.3 it's possible to use an ajax timer
directly on a page like I did. This part of the stuff was indeed
working, as indicated some time ago by igor.

A last question : what does precisely the session.invalidate stuff ?
Indeed, in my application, when checking if the user is logged in, I
just check whether an user is in the current session. As such, to
"unlog" my user, I just need to do something like
session.setUser(null). So I wonder what does precisely the invalidate
(and as such whether I really need to do it or not). I checked on the
API already and there is just :"Invalidates this session."

Thanks in advance
ZedroS

On 4/19/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> On 4/19/07, ZedroS Schwart <[EMAIL PROTECTED]> wrote:
> > Hi Johan
> >
> > I still don't manage to do redirection from my code.
> >
> > I've even tried to do some redirection to other website or the base
> > URL of my app without success.
> >
> > The code I use is the following :
> > package purgat.web.pages.user;
> >
> > import org.apache.wicket.PageParameters;
> > import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
> > import org.apache.wicket.ajax.AjaxRequestTarget;
> > import org.apache.wicket.markup.html.link.BookmarkablePageLink;
> > import org.apache.wicket.markup.html.pages.RedirectPage;
> > import org.apache.wicket.util.time.Duration;
> >
> > import purgat.web.PurgatSession;
> > import purgat.web.SecuredBasePage;
> > import purgat.web.pages.base.IntroPage;
> >
> > public class LogoutPage extends SecuredBasePage {
> >         public LogoutPage() {
> >                 super();
> >                 // Setting of the session's user to null to indicate the 
> > user isn't log
> >                 // in anymore
> >                 ((PurgatSession) getSession()).setUser(null);
> >                 BookmarkablePageLink manualLink = new 
> > BookmarkablePageLink("linkTest",
> >                                 IntroPage.class);
> >                 add(manualLink);
> >
> >                 add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
> >                         protected void onTimer(AjaxRequestTarget target) {
> >                                 setRedirect(true);
> >
> >                                 // setResponsePage(new 
> > RedirectPage("http://www.google.com";));
> >                                 
> > getResponse().redirect("http://www.google.com";);
> >                         }
> >                 });
> >         }
> > }
> >
> > Instead of http://www.google.com I tried with the base URL of my app.
> > I'm using wicket 1.3 latest snapshot.
> >
> > What's wrong with my code ??
>
> You can't use an ajax timer directly on page I think. There's a thread
> about it this week.
>
> This is the logout page we're using for the project I'm working on:
>
> public class LogOutPage extends WebPage {
>
>         public LogOutPage() {
>
>                 setResponsePage(LoginPage.class);
>                 ((WebSession) getSession()).invalidate();
>         }
> }
>
> setResponsePage could be anything you want, like a redirect page, or
> you could call RequestCycle.get().setRequestTarget() with e.g. an
> instance of RedirectRequestTarget.
>
> Not sure how well this works in 1.2 though.
>
> Eelco
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to