@Override public Route deleteWithRegex(String regex) { return router.deleteWithRegex(regex); }
@Test public void testDeleteWithRegex() throws Exception { router.deleteWithRegex("\\/somepath\\/.*").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.DELETE, "/somepath/whatever", 200, "foo"); testRequest(HttpMethod.DELETE, "/otherpath/whatever", 404, "Not Found"); testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found"); }
/** * Add a route that matches a HTTP DELETE request and the specified path regex * @param regex URI paths that begin with a match for this regex will match * @return the route */ public io.vertx.rxjava.ext.web.Route deleteWithRegex(String regex) { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.deleteWithRegex(regex)); return ret; }
/** * Add a route that matches a HTTP DELETE request and the specified path regex * @param regex URI paths that begin with a match for this regex will match * @return the route */ public io.vertx.rxjava.ext.web.Route deleteWithRegex(String regex) { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.deleteWithRegex(regex)); return ret; }
@Override public io.vertx.ext.web.Route deleteWithRegex(String regex) { return delegate.deleteWithRegex(getFullPath(regex)); }
private void installMethodForwarder(io.vertx.ext.web.Router newRouter, Rule rule, Handler<RoutingContext> forwarder) { for (String method : rule.getMethods()) { log.info("Installing " + rule.getScheme().toUpperCase() + " forwarder for methods " + method + " to " + rule.getUrlPattern()); switch (method) { case "GET": newRouter.getWithRegex(rule.getUrlPattern()).handler(forwarder); break; case "PUT": newRouter.putWithRegex(rule.getUrlPattern()).handler(forwarder); break; case "POST": newRouter.postWithRegex(rule.getUrlPattern()).handler(forwarder); break; case "DELETE": newRouter.deleteWithRegex(rule.getUrlPattern()).handler(forwarder); break; } } }
@Test public void testDeleteWithRegex() throws Exception { router.deleteWithRegex("\\/somepath\\/.*").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.DELETE, "/somepath/whatever", 200, "foo"); testRequest(HttpMethod.DELETE, "/otherpath/whatever", 404, "Not Found"); testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found"); }
router.deleteWithRegex(prefix + "/queues/[^/]+").handler(this::deleteAllQueueItems); router.deleteWithRegex(prefix + "/queues/([^/]+)/[0-9]+").handler(this::deleteQueueItem); router.deleteWithRegex(prefix + "/locks/[^/]+").handler(this::deleteSingleLock);
router.deleteWithRegex(prefix + "/queues/[^/]+").handler(ctx -> { final String queue = lastPart(ctx.request().path(), "/"); eb.send(redisquesAddress, buildDeleteAllQueueItemsOperation(queue), reply -> { router.deleteWithRegex(prefix + "/queues/([^/]+)/[0-9]+").handler(ctx -> { final String queue = part(ctx.request().path(), "/", 2); final int index = Integer.parseInt(lastPart(ctx.request().path(), "/")); router.deleteWithRegex(prefix + "/locks/[^/]+").handler(ctx -> { String queue = lastPart(ctx.request().path(), "/"); eb.send(redisquesAddress, buildDeleteLockOperation(queue), new Handler<AsyncResult<Message<JsonObject>>>() {
router.deleteWithRegex(prefix + "/queues/[^/]+").handler(ctx -> { final String queue = lastPart(ctx.request().path(), "/"); eb.send(redisquesAddress, buildDeleteAllQueueItemsOperation(queue), reply -> { router.deleteWithRegex(prefix + "/queues/([^/]+)/[0-9]+").handler(ctx -> { final String queue = part(ctx.request().path(), "/", 2); final int index = Integer.parseInt(lastPart(ctx.request().path(), "/")); router.deleteWithRegex(prefix + "/locks/[^/]+").handler(ctx -> { String queue = lastPart(ctx.request().path(), "/"); eb.send(redisquesAddress, buildDeleteLockOperation(queue), new Handler<AsyncResult<Message<JsonObject>>>() {