本文整理了Java中io.vertx.ext.web.Route.method
方法的一些代码示例,展示了Route.method
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Route.method
方法的具体详情如下:
包路径:io.vertx.ext.web.Route
类名称:Route
方法名:method
[英]Add an HTTP method for this route. By default a route will match all HTTP methods. If any are specified then the route will only match any of the specified methods
[中]为此路由添加HTTP方法。默认情况下,路由将匹配所有HTTP方法。如果指定了任何方法,则路由将只匹配任何指定的方法
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route trace() {
return route().method(HttpMethod.TRACE);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route patch() {
return route().method(HttpMethod.PATCH);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route head() {
return route().method(HttpMethod.HEAD);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route options() {
return route().method(HttpMethod.OPTIONS);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route post() {
return route().method(HttpMethod.POST);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route delete() {
return route().method(HttpMethod.DELETE);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route put() {
return route().method(HttpMethod.PUT);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route getWithRegex(String path) {
return route().method(HttpMethod.GET).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route traceWithRegex(String path) {
return route().method(HttpMethod.TRACE).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route optionsWithRegex(String path) {
return route().method(HttpMethod.OPTIONS).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route postWithRegex(String path) {
return route().method(HttpMethod.POST).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route connectWithRegex(String path) {
return route().method(HttpMethod.CONNECT).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route headWithRegex(String path) {
return route().method(HttpMethod.HEAD).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route putWithRegex(String path) {
return route().method(HttpMethod.PUT).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Override
public Route patchWithRegex(String path) {
return route().method(HttpMethod.PATCH).pathRegex(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testRoutePathAndMultipleMethodBuilderBegin() throws Exception {
String path = "/blah";
router.route().path(path + "*").method(HttpMethod.GET).method(HttpMethod.POST).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end());
testPathBegin(HttpMethod.GET, path);
testPathBegin(HttpMethod.POST, path);
testRequest(HttpMethod.PUT, path, 404, "Not Found");
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testRoutePathAndMultipleMethodBuilder() throws Exception {
String path = "/blah";
router.route().path(path).method(HttpMethod.GET).method(HttpMethod.POST).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end());
testPathExact(HttpMethod.GET, path);
testPathExact(HttpMethod.POST, path);
testRequest(HttpMethod.PUT, path, 404, "Not Found");
}
代码示例来源:origin: vert-x3/vertx-web
private void testRouteNoPathWithMethod(HttpMethod meth) throws Exception {
router.clear();
router.route().method(meth).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end());
testNoPath(meth);
for (HttpMethod m : METHODS) {
if (m != meth) {
testRequest(m, "/whatever", 404, "Not Found");
}
}
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testRoutePathAndMethodBuilder() throws Exception {
String path = "/blah";
router.route().path(path).method(HttpMethod.GET).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end());
testPathExact(HttpMethod.GET, path);
testRequest(HttpMethod.POST, path, 404, "Not Found");
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testRoutePathAndMethodBuilderBegin() throws Exception {
String path = "/blah";
router.route().path(path + "*").method(HttpMethod.GET).handler(rc -> rc.response().setStatusCode(200).setStatusMessage(rc.request().path()).end());
testPathBegin(HttpMethod.GET, path);
testRequest(HttpMethod.POST, path, 404, "Not Found");
}
内容来源于网络,如有侵权,请联系作者删除!