@Override public Route options(String path) { return router.options(path); }
@Override public Route options() { return router.options(); }
@Override public io.vertx.ext.web.Route options() { return delegate.options(); }
@Test public void testOptions() throws Exception { router.options().handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.OPTIONS, "/whatever", 200, "foo"); testRequest(HttpMethod.GET, "/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/whatever", 404, "Not Found"); }
@Test public void testOptionsWithPathExact() throws Exception { router.options("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.OPTIONS, "/somepath/", 200, "foo"); testRequest(HttpMethod.OPTIONS, "/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.DELETE, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found"); }
@Test public void testOptionsWithPathBegin() throws Exception { router.options("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 200, "foo"); testRequest(HttpMethod.OPTIONS, "/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.DELETE, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found"); }
/** * Add a route that matches any HTTP OPTIONS request * @return the route */ public io.vertx.rxjava.ext.web.Route options() { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.options()); return ret; }
/** * Add a route that matches a HTTP OPTIONS request and the specified path * @param path URI paths that begin with this path will match * @return the route */ public io.vertx.rxjava.ext.web.Route options(String path) { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.options(path)); return ret; }
/** * Add a route that matches any HTTP OPTIONS request * @return the route */ public io.vertx.rxjava.ext.web.Route options() { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.options()); return ret; }
/** * Add a route that matches a HTTP OPTIONS request and the specified path * @param path URI paths that begin with this path will match * @return the route */ public io.vertx.rxjava.ext.web.Route options(String path) { io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.options(path)); return ret; }
@Override public io.vertx.ext.web.Route options(String path) { return delegate.options(getFullPath(path)); }
private static void initHttpOptions( VxmsShared vxmsShared, Router router, Object service, Method restMethod, Path path, Stream<Method> errorMethodStream, Optional<Consumes> consumes) { final Route route = router.options(URIUtil.cleanPath(path.value())); final Vertx vertx = vxmsShared.getVertx(); final Context context = vertx.getOrCreateContext(); final String methodId = path.value() + OPTIONS.class.getName() + ConfigurationUtil.getCircuitBreakerIDPostfix(context.config()); initHttpOperation( methodId, vxmsShared, service, restMethod, route, errorMethodStream, consumes, OPTIONS.class); }
@Override public Router createRouter(Vertx vertx) { this.vertx = vertx; Router router = Router.router(vertx); router.get("/").handler(this::onGetAll); router.get("/:id").handler(this::onGetByCorrelationId); router.options("/").handler(this::onOptions); return router; }
@Override public Router createRouter(Vertx vertx) { Router router = Router.router(vertx); router.get("/").handler(this::onInfo); router.head("/").handler(this::onPing); router.options("/").handler(this::onOptions); return router; }
@Test public void testOptions() throws Exception { router.options().handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.OPTIONS, "/whatever", 200, "foo"); testRequest(HttpMethod.GET, "/whatever", 404, "Not Found"); testRequest(HttpMethod.POST, "/whatever", 404, "Not Found"); testRequest(HttpMethod.PUT, "/whatever", 404, "Not Found"); testRequest(HttpMethod.DELETE, "/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/whatever", 404, "Not Found"); }
@Test public void testOptionsWithPathExact() throws Exception { router.options("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.OPTIONS, "/somepath/", 200, "foo"); testRequest(HttpMethod.OPTIONS, "/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.DELETE, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found"); }
@Test public void testOptionsWithPathBegin() throws Exception { router.options("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end()); testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 200, "foo"); testRequest(HttpMethod.OPTIONS, "/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.DELETE, "/somepath/whatever", 404, "Not Found"); testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found"); }