本文整理了Java中io.vertx.ext.web.Router.options
方法的一些代码示例,展示了Router.options
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.options
方法的具体详情如下:
包路径:io.vertx.ext.web.Router
类名称: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");
}
内容来源于网络,如有侵权,请联系作者删除!