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

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

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

Route.remove介绍

[英]Remove this route from the router
[中]从路由器中删除此路由

代码示例

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

/**
 * Remove this route from the router
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.web.Route remove() { 
 delegate.remove();
 return this;
}

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

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

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

/**
 * Remove this route from the router
 * @return a reference to this, so the API can be used fluently
 */
public io.vertx.rxjava.ext.web.Route remove() { 
 delegate.remove();
 return this;
}

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

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

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

@Test
public void testRemove() 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.remove();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesbananas");
 route1.remove();
 route3.remove();
 testRequest(HttpMethod.GET, path, 404, "Not Found");
}

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

@Test
public void testSetHandleFileUploads() throws Exception
{
 String dirName = getNotCreatedTemporaryFolderName();
 router.clear();
 
 BodyHandler bodyHandler = BodyHandler.create().setUploadsDirectory(dirName).setHandleFileUploads(false);
 router.route().handler(bodyHandler);
 
 Buffer fileData = TestUtils.randomBuffer(50);
 Route route = router.route().handler(rc -> {
  rc.response().end();
  assertFalse("Upload directory must not be created.", vertx.fileSystem().existsBlocking(dirName));
 });
 sendFileUploadRequest(fileData, 200, "OK");
 
 route.remove();
 bodyHandler.setHandleFileUploads(true);
 router.route().handler(rc -> {
  rc.response().end();
  assertTrue("Upload directory must be created.", vertx.fileSystem().existsBlocking(dirName));
 });
 sendFileUploadRequest(fileData, 200, "OK");
}

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

@Test
public void testRemove() 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.remove();
 testRequest(HttpMethod.GET, path, 200, "OK", "applesbananas");
 route1.remove();
 route3.remove();
 testRequest(HttpMethod.GET, path, 404, "Not Found");
}

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

@Test
public void testSetHandleFileUploads() throws Exception
{
 String dirName = getNotCreatedTemporaryFolderName();
 router.clear();
 
 BodyHandler bodyHandler = BodyHandler.create().setUploadsDirectory(dirName).setHandleFileUploads(false);
 router.route().handler(bodyHandler);
 
 Buffer fileData = TestUtils.randomBuffer(50);
 Route route = router.route().handler(rc -> {
  rc.response().end();
  assertFalse("Upload directory must not be created.", vertx.fileSystem().existsBlocking(dirName));
 });
 sendFileUploadRequest(fileData, 200, "OK");
 
 route.remove();
 bodyHandler.setHandleFileUploads(true);
 router.route().handler(rc -> {
  rc.response().end();
  assertTrue("Upload directory must be created.", vertx.fileSystem().existsBlocking(dirName));
 });
 sendFileUploadRequest(fileData, 200, "OK");
}

相关文章