本文整理了Java中io.vertx.ext.web.Route.pathRegex
方法的一些代码示例,展示了Route.pathRegex
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Route.pathRegex
方法的具体详情如下:
包路径:io.vertx.ext.web.Route
类名称:Route
方法名:pathRegex
[英]Set the path prefix as a regular expression. If set then this route will only match request URI paths, the beginning of which match the regex. Only a single path or path regex can be set for a route.
[中]将路径前缀设置为正则表达式。如果设置了,那么该路由将只匹配请求URI路径,其开头与正则表达式匹配。只能为路由设置单个路径或路径正则表达式。
代码示例来源: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 deleteWithRegex(String path) {
return route().method(HttpMethod.DELETE).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
@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 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 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: io.vertx/vertx-rx-java
/**
* Set the path prefix as a regular expression. If set then this route will only match request URI paths, the beginning
* of which match the regex. Only a single path or path regex can be set for a route.
* @param path the path regex
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.ext.web.Route pathRegex(String path) {
delegate.pathRegex(path);
return this;
}
代码示例来源:origin: gentics/mesh
@Override
public InternalEndpointRoute pathRegex(String path) {
this.pathRegex = path;
route.pathRegex(path);
return this;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Set the path prefix as a regular expression. If set then this route will only match request URI paths, the beginning
* of which match the regex. Only a single path or path regex can be set for a route.
* @param path the path regex
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.rxjava.ext.web.Route pathRegex(String path) {
delegate.pathRegex(path);
return this;
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testSecurityBypass() throws Exception {
Handler<RoutingContext> handler = rc -> {
fail("should not get here");
rc.response().end("Welcome to the protected resource!");
};
JsonObject authConfig = new JsonObject().put("properties_path", "classpath:login/loginusers.properties");
AuthProvider authProvider = ShiroAuth.create(vertx, new ShiroAuthOptions().setType(ShiroAuthRealmType.PROPERTIES).setConfig(authConfig));
router.route().pathRegex("/api/.*").handler(BasicAuthHandler.create(authProvider));
router.route("/api/v1/standard-job-profiles").handler(handler);
testRequest(HttpMethod.GET, "//api/v1/standard-job-profiles", 401, "Unauthorized");
}
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testRegex1WithBuilder() throws Exception {
router.route().pathRegex("\\/([^\\/]+)\\/([^\\/]+)").handler(rc -> {
MultiMap params = rc.request().params();
rc.response().setStatusMessage(params.get("param0") + params.get("param1")).end();
});
testPattern("/dog/cat", "dogcat");
}
代码示例来源:origin: io.vertx/vertx-web
@Override
public Route getWithRegex(String path) {
return route().method(HttpMethod.GET).pathRegex(path);
}
代码示例来源:origin: io.vertx/vertx-web
@Override
public Route deleteWithRegex(String path) {
return route().method(HttpMethod.DELETE).pathRegex(path);
}
代码示例来源:origin: io.vertx/vertx-web
@Override
public Route optionsWithRegex(String path) {
return route().method(HttpMethod.OPTIONS).pathRegex(path);
}
代码示例来源:origin: io.vertx/vertx-web
@Override
public Route connectWithRegex(String path) {
return route().method(HttpMethod.CONNECT).pathRegex(path);
}
代码示例来源:origin: io.vertx/vertx-web
@Override
public Route headWithRegex(String path) {
return route().method(HttpMethod.HEAD).pathRegex(path);
}
代码示例来源:origin: io.vertx/vertx-web
@Test
public void testRegex1WithBuilder() throws Exception {
router.route().pathRegex("\\/([^\\/]+)\\/([^\\/]+)").handler(rc -> {
MultiMap params = rc.request().params();
rc.response().setStatusMessage(params.get("param0") + params.get("param1")).end();
});
testPattern("/dog/cat", "dogcat");
}
内容来源于网络,如有侵权,请联系作者删除!