通过使用控制器中的redirect()方法似乎可以重定向到内部URL。
public static Result index() {
return redirect(routes.Application.tasks());
}
但是我想重定向到控制器中的外部 URL。 redirect(String) 方法仅接受内部 URL 作为参数。
我需要的是相当于标准 Java servlet 重定向的 Play 框架,即
request.sendRedirect(String url)
有时最简单的解决方案只是......有效:
return redirect("http://stackoverflow.com/questions/10962694");
也值得使用其他可用的重定向 such as
seeOther(String url)
movedPermanently(String url)
temporaryRedirect(String url)
etc
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)