io.vertx.ext.web.Router.options()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中io.vertx.ext.web.Router.options方法的一些代码示例,展示了Router.options的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.options方法的具体详情如下:
包路径:io.vertx.ext.web.Router
类名称:Router
方法名:options

Router.options介绍

[英]Add a route that matches any HTTP OPTIONS request
[中]添加与任何HTTP选项请求匹配的路由

代码示例

代码示例来源:origin: vert-x3/vertx-web

router.options("/chunking_test").handler(BaseTransport.createCORSOptionsHandler(options, "OPTIONS, POST"));
router.options("/info").handler(BaseTransport.createCORSOptionsHandler(options, "OPTIONS, GET"));

代码示例来源:origin: org.zalando/vertx-swagger

@Override
public Route options(String path) {
  return router.options(path);
}

代码示例来源:origin: org.zalando/vertx-swagger

@Override
public Route options() {
  return router.options();
}

代码示例来源:origin: wang007/vertx-start

@Override
public io.vertx.ext.web.Route options() {
  return delegate.options();
}

代码示例来源:origin: vert-x3/vertx-web

@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");
}

代码示例来源:origin: vert-x3/vertx-web

@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");
}

代码示例来源:origin: vert-x3/vertx-web

@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");
}

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * 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;
}

代码示例来源:origin: io.vertx/vertx-rx-java

/**
 * 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;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * 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;
}

代码示例来源:origin: vert-x3/vertx-rx

/**
 * 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;
}

代码示例来源:origin: wang007/vertx-start

@Override
public io.vertx.ext.web.Route options(String path) {
  return delegate.options(getFullPath(path));
}

代码示例来源:origin: amoAHCP/vxms

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);
}

代码示例来源:origin: georocket/georocket

@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;
}

代码示例来源:origin: georocket/georocket

@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;
}

代码示例来源:origin: io.vertx/vertx-web

router.options("/chunking_test").handler(BaseTransport.createCORSOptionsHandler(options, "OPTIONS, POST"));
router.options("/info").handler(BaseTransport.createCORSOptionsHandler(options, "OPTIONS, GET"));

代码示例来源:origin: io.vertx/vertx-web

@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");
}

代码示例来源:origin: io.vertx/vertx-web

@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");
}

代码示例来源:origin: io.vertx/vertx-web

@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");
}

相关文章