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);
See
org.apache.wicket.request.cycle.RequestCycle.scheduleRequestHandlerAfterCurrent(IRequestHandler)
and
org.apache.wicket.request.http.handler.RedirectRequestHandler.RedirectRequestHandler(String)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With