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

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

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

Route.disable介绍

[英]Disable this route. While disabled the router will not route any requests or failures to it.
[中]禁用此路径。禁用时,路由器不会将任何请求或故障路由到路由器。

代码示例

代码示例来源:origin: gentics/mesh

@Override
public InternalEndpointRoute disable() {
  route.disable();
  return this;
}

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

/**
 * Disable this route. While disabled the router will not route any requests or failures to it.
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.web.Route disable() { 
 delegate.disable();
 return this;
}

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

/**
 * Disable this route. While disabled the router will not route any requests or failures to it.
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.web.Route disable() { 
 delegate.disable();
 return this;
}

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

@Override
public Route disable() {
  return delegate.disable();
}

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

@Test
public void testDisableEnable() throws Exception {
 String path = "/blah";
 Route route1 = router.route(path).handler(rc -> {
  rc.response().setChunked(true);
  rc.response().write("apples");
  rc.next();
 });
 Route route2 = router.route(path).handler(rc -> {
  rc.response().write("oranges");
  rc.next();
 });
 Route route3 = router.route(path).handler(rc -> {
  rc.response().write("bananas");
  rc.response().end();
 });
 testRequest(HttpMethod.GET, path, 200, "OK", "applesorangesbananas");
 route2.disable();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesbananas");
 route1.disable();
 route3.disable();
 testRequest(HttpMethod.GET, path, 404, "Not Found");
 route3.enable();
 route1.enable();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesbananas");
 route2.enable();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesorangesbananas");
}

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

@Test
public void testDisableEnable() throws Exception {
 String path = "/blah";
 Route route1 = router.route(path).handler(rc -> {
  rc.response().setChunked(true);
  rc.response().write("apples");
  rc.next();
 });
 Route route2 = router.route(path).handler(rc -> {
  rc.response().write("oranges");
  rc.next();
 });
 Route route3 = router.route(path).handler(rc -> {
  rc.response().write("bananas");
  rc.response().end();
 });
 testRequest(HttpMethod.GET, path, 200, "OK", "applesorangesbananas");
 route2.disable();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesbananas");
 route1.disable();
 route3.disable();
 testRequest(HttpMethod.GET, path, 404, "Not Found");
 route3.enable();
 route1.enable();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesbananas");
 route2.enable();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesorangesbananas");
}

相关文章