How do I do the following in Wicket 1.5?
page.getRequestCycle().setRequestTarget(new RedirectRequestTarget("http://www.facebook.com/login.php?api_key="+ _apiKey + "&v=1.0"));
I want to do a Facebook application using Wicket 1.5, and I want at some point to redirect the user to the Facebook login page. A lot has changed as highlighted in Migrating to Wicket 1.5.
Using HTTP 302 ("Moved Temporarily"):
import org.apache.wicket.request.flow.RedirectToUrlException;
...
throw new RedirectToUrlException(
"http://www.facebook.com/login.php?api_key="+ _apiKey + "&v=1.0");
Using HTTP 301 ("Moved Permanently", SEO friendly):
import org.apache.wicket.request.flow.RedirectToUrlException;
import javax.servlet.http.HttpServletResponse;
...
throw new RedirectToUrlException(
"http://www.facebook.com/login.php?api_key="+ _apiKey + "&v=1.0",
HttpServletResponse.SC_MOVED_PERMANENTLY);