Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Facebook provides a custom tag to accomplish a redirect within the Facebook canvas - Fb:redirect (http://wiki.developers.facebook.com/index.php/Fb:redirectImage Removed).

I ended up doing a custom IRequestTarget implementation for this purpose, and thought I'd share what I came up with here. Please bear with my very limited experience with Wicket, I was just happy to get it working for my simple need. Feel free to edit/add to this as you see fit.

...

Code Block
import org.apache.wicket.Page;
import org.apache.wicket.PageParameters;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.request.IRequestCycleProcessor;
import org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;

public class FBRedirectRequestTarget extends BookmarkablePageRequestTarget
{
    public FBRedirectRequestTarget(Class pageClass)
    {
        this(pageClass, null);
    }

    public FBRedirectRequestTarget(Class pageClass,
            PageParameters pageParameters)
    {
        super(null, pageClass, pageParameters);
    }

    public void respond(RequestCycle requestCycle)
    {
        IRequestCycleProcessor processor = requestCycle.getProcessor();
        String redirectUrl = processor.getRequestCodingStrategy().encode(
                requestCycle, this).toString();
        Page page = new RedirectPageFBRedirectPage(redirectUrl);
        page.renderPage();
    }

}

...