/*
 * Copyright (C) 2009-2019 Lightbend Inc. <https://www.lightbend.com>
 */

package javaguide.binder.controllers;

//#javascript-router-resource-imports
import play.mvc.Http;
import play.routing.JavaScriptReverseRouter;
import play.mvc.Controller;
import play.mvc.Result;
//#javascript-router-resource-imports

public class Application extends Controller {
    
    //#javascript-router-resource
    public Result javascriptRoutes(Http.Request request) {
        return ok(
            //###skip: 1
            // TODO: After Play 2.7 use create(String name, String host, JavaScriptReverseRoute... routes) instead
            JavaScriptReverseRouter.create("jsRoutes", request.host(), "jQuery.ajax",
                routes.javascript.Users.list(),
                routes.javascript.Users.get()
            )
        ).as(Http.MimeTypes.JAVASCRIPT);
    }
    //#javascript-router-resource

    public Result javascriptRoutes2(Http.Request request) {
        return ok(
            //#javascript-router-resource-custom-method
            JavaScriptReverseRouter.create("jsRoutes", request.host(), "myAjaxMethod",
                routes.javascript.Users.list(),
                routes.javascript.Users.get()
            )
            //#javascript-router-resource-custom-method
        ).as(Http.MimeTypes.JAVASCRIPT);
    }
}

@@ -668,37 +668,37 @@
 s%22, 
-request.host(), %22jQuery.ajax%22
+%22jQuery.ajax%22, request.host()
 ,%0A  
@@ -1079,38 +1079,38 @@
 s%22, 
-request.host(), %22myAjaxMethod%22
+%22myAjaxMethod%22, request.host()
 ,%0A  

Correct order of params in doc example (#8916)