@Override public Route optionsWithRegex(String path) { return route().method(HttpMethod.OPTIONS).pathRegex(path); }
@Override public Route deleteWithRegex(String path) { return route().method(HttpMethod.DELETE).pathRegex(path); }
@Override public Route patchWithRegex(String path) { return route().method(HttpMethod.PATCH).pathRegex(path); }
@Override public Route headWithRegex(String path) { return route().method(HttpMethod.HEAD).pathRegex(path); }
@Override public Route putWithRegex(String path) { return route().method(HttpMethod.PUT).pathRegex(path); }
@Override public Route postWithRegex(String path) { return route().method(HttpMethod.POST).pathRegex(path); }
@Override public Route connectWithRegex(String path) { return route().method(HttpMethod.CONNECT).pathRegex(path); }
@Override public Route getWithRegex(String path) { return route().method(HttpMethod.GET).pathRegex(path); }
@Override public Route traceWithRegex(String path) { return route().method(HttpMethod.TRACE).pathRegex(path); }
/** * 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; }
@Override public InternalEndpointRoute pathRegex(String path) { this.pathRegex = path; route.pathRegex(path); return this; }
/** * 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; }
@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"); } }
@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"); }
@Override public Route getWithRegex(String path) { return route().method(HttpMethod.GET).pathRegex(path); }
@Override public Route deleteWithRegex(String path) { return route().method(HttpMethod.DELETE).pathRegex(path); }
@Override public Route optionsWithRegex(String path) { return route().method(HttpMethod.OPTIONS).pathRegex(path); }
@Override public Route connectWithRegex(String path) { return route().method(HttpMethod.CONNECT).pathRegex(path); }
@Override public Route headWithRegex(String path) { return route().method(HttpMethod.HEAD).pathRegex(path); }
@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"); }