本文整理汇总了Java中play.routing.RoutingDsl类的典型用法代码示例。如果您正苦于以下问题:Java RoutingDsl类的具体用法?Java RoutingDsl怎么用?Java RoutingDsl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RoutingDsl类属于play.routing包,在下文中一共展示了RoutingDsl类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import play.routing.RoutingDsl; //导入依赖的package包/类
public static void main(String[] args) {
Router router = new RoutingDsl().
GET("/").routeTo(() -> ok("Hello World!")).
build();
Server server = Server.forRouter(router, 8080);
System.out.println("Server started on " + server.httpPort());
}
示例2: testServer
import play.routing.RoutingDsl; //导入依赖的package包/类
private TestServer testServer(final boolean isAuthEnabled) {
final Router router = new RoutingDsl()
.GET(URI).routeTo(() -> ok())
.build();
final Application app = new GuiceApplicationBuilder()
.configure("play.http.filters", "com.commercetools.sunrise.httpauth.basic.BasicHttpAuthenticationFilters")
.overrides(
bind(HttpAuthentication.class).toInstance(httpAuthentication(isAuthEnabled)),
bind(play.api.routing.Router.class).toInstance(router.asScala()))
.build();
return Helpers.testServer(app);
}
示例3: provideApplication
import play.routing.RoutingDsl; //导入依赖的package包/类
@Override
protected Application provideApplication() {
final Router router = new RoutingDsl()
.GET(URI).routeTo(() -> ok())
.build();
return new GuiceApplicationBuilder()
.configure("play.http.filters", "com.commercetools.sunrise.httpauth.basic.BasicHttpAuthenticationFilters")
.overrides(
bind(HttpAuthentication.class).toInstance(new BasicHttpAuthentication(REALM, USERNAME + ":" + PASSWORD)),
bind(play.api.routing.Router.class).toInstance(router.asScala()))
.build();
}
开发者ID:commercetools,项目名称:commercetools-sunrise-java,代码行数:13,代码来源:BasicHttpAuthenticationFilterTest.java
示例4: MockRouterProvider
import play.routing.RoutingDsl; //导入依赖的package包/类
@Inject
public MockRouterProvider(RoutingDsl routingDsl) {
this.routingDsl = routingDsl;
}