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

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

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

Router.put介绍

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

代码示例

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

@Override
public void start() {
 setUpInitialData();
 Router router = Router.router(vertx);
 router.route().handler(BodyHandler.create());
 router.get("/products/:productID").handler(this::handleGetProduct);
 router.put("/products/:productID").handler(this::handleAddProduct);
 router.get("/products").handler(this::handleListProducts);
 vertx.createHttpServer().requestHandler(router).listen(8080);
}

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

@Validate
public void start() throws Exception {
 setUpInitialData();
 TcclSwitch.executeWithTCCLSwitch(() -> {
  Router router = Router.router(vertx);
  router.route().handler(BodyHandler.create());
  router.get("/products/:productID").handler(this::handleGetProduct);
  router.put("/products/:productID").handler(this::handleAddProduct);
  router.get("/products").handler(this::handleListProducts);
  router.get("/assets/*").handler(StaticHandler.create("assets", this.getClass().getClassLoader()));
  LOGGER.info("Creating HTTP server for vert.x web application");
  HttpServer server = vertx.createHttpServer();
  server.requestHandler(router).listen(8081);
 });
}

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

});
router.put("/api/users/:id").handler(ctx -> {
 mongo.findOne("users", new JsonObject().put("_id", ctx.request().getParam("id")), null, lookup -> {

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

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

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

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

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

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

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

@Test
public void testPut() throws Exception {
 router.put().handler(rc -> rc.response().setStatusMessage("foo").end());
 testRequest(HttpMethod.PUT, "/whatever", 200, "foo");
 testRequest(HttpMethod.GET, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.POST, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.DELETE, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.OPTIONS, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.HEAD, "/whatever", 404, "Not Found");
}

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

@Test
public void testPutWithPathExact() throws Exception {
 router.put("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end());
 testRequest(HttpMethod.PUT, "/somepath/", 200, "foo");
 testRequest(HttpMethod.PUT, "/otherpath/whatever", 404, "Not Found");
 testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found");
}

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

@Test
public void testPutWithPathBegin() throws Exception {
 router.put("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end());
 testRequest(HttpMethod.PUT, "/somepath/whatever", 200, "foo");
 testRequest(HttpMethod.PUT, "/otherpath/whatever", 404, "Not Found");
 testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found");
}

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

/**
 * Add a route that matches a HTTP PUT 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 put(String path) { 
 io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.put(path));
 return ret;
}

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

/**
 * Add a route that matches any HTTP PUT request
 * @return the route
 */
public io.vertx.rxjava.ext.web.Route put() { 
 io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.put());
 return ret;
}

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

/**
 * Add a route that matches any HTTP PUT request
 * @return the route
 */
public io.vertx.rxjava.ext.web.Route put() { 
 io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.put());
 return ret;
}

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

/**
 * Add a route that matches a HTTP PUT 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 put(String path) { 
 io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.put(path));
 return ret;
}

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

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

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

@Override
public Router createRouter(Vertx vertx) {
 this.vertx = vertx;
 store = new RxStore(StoreFactory.createStore(vertx));
 storagePath = vertx.getOrCreateContext().config()
  .getString(ConfigConstants.STORAGE_FILE_PATH);
 Router router = Router.router(vertx);
 router.get("/*").handler(this::onGet);
 router.put("/*").handler(this::onPut);
 router.post("/*").handler(this::onPost);
 router.delete("/*").handler(this::onDelete);
 return router;
}

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

/**
 * Registers the routes.
 *
 * @param router the router
 * @param root   the root
 */
private void registerRoutes(Router router, String root) {
 // Get all and query
 router.get(root).handler(this::all);
 // Get one
 router.get(root + "/:uuid").handler(this::one);
 // Unpublish
 router.delete(root + "/:uuid").handler(this::unpublish);
 // Publish
 router.route().handler(BodyHandler.create());
 router.post(root).handler(this::publish);
 // Update
 router.put(root + "/:uuid").handler(this::update);
}

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

@Test
public void testPut() throws Exception {
 router.put().handler(rc -> rc.response().setStatusMessage("foo").end());
 testRequest(HttpMethod.PUT, "/whatever", 200, "foo");
 testRequest(HttpMethod.GET, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.POST, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.DELETE, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.OPTIONS, "/whatever", 404, "Not Found");
 testRequest(HttpMethod.HEAD, "/whatever", 404, "Not Found");
}

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

/**
 * Registers the routes.
 *
 * @param router the router
 * @param root   the root
 */
private void registerRoutes(Router router, String root) {
 // Get all and query
 router.get(root).handler(this::all);
 // Get one
 router.get(root + "/:uuid").handler(this::one);
 // Unpublish
 router.delete(root + "/:uuid").handler(this::unpublish);
 // Publish
 router.route().handler(BodyHandler.create());
 router.post(root).handler(this::publish);
 // Update
 router.put(root + "/:uuid").handler(this::update);
}

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

@Test
public void testPutWithPathExact() throws Exception {
 router.put("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end());
 testRequest(HttpMethod.PUT, "/somepath/", 200, "foo");
 testRequest(HttpMethod.PUT, "/otherpath/whatever", 404, "Not Found");
 testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found");
}

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

@Test
public void testPutWithPathBegin() throws Exception {
 router.put("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end());
 testRequest(HttpMethod.PUT, "/somepath/whatever", 200, "foo");
 testRequest(HttpMethod.PUT, "/otherpath/whatever", 404, "Not Found");
 testRequest(HttpMethod.GET, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.POST, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.DELETE, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.OPTIONS, "/somepath/whatever", 404, "Not Found");
 testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found");
}

相关文章