man*_*h_s 8 playframework playframework-2.0
通过在控制器中使用redirect()方法,似乎可以重定向到内部URL.
public static Result index() {
return redirect(routes.Application.tasks());
}
Run Code Online (Sandbox Code Playgroud)
但是,我想重定向到控制器中的外部URL.redirect(String)方法仅接受内部URL作为参数.
我需要的是Play框架相当于标准的Java servlet重定向,即
request.sendRedirect(String url)
Run Code Online (Sandbox Code Playgroud)
bie*_*ior 20
有时最简单的解决方案......工作:
return redirect("http://stackoverflow.com/questions/10962694");
Run Code Online (Sandbox Code Playgroud)
这也是值得使用其他速效重定向这样
seeOther(String url)movedPermanently(String url)temporaryRedirect(String url)等等