开发者

Playframework: routes entry to an external URL

开发者 https://www.devze.com 2023-03-31 01:57 出处:网络
I want the following redirect开发者_如何学Goion functionality GET /googlegoogle.com How should I implement this?It does not seem it is possible to do that straight from the routes files at this mom

I want the following redirect开发者_如何学Goion functionality

GET /google    google.com

How should I implement this?


It does not seem it is possible to do that straight from the routes files at this moment.

You could implement this in a controller:

public class Application extends Controller {

 public static void google() {
    redirect("http://www.google.com");
 }
}


GET /google    controllers.Default.redirect(to = "http://google.com/")

(Re-post of FoREacH's comment because it's worth being here as an answer)

0

精彩评论

暂无评论...
验证码 换一张
取 消