本文整理了Java中io.vertx.ext.web.Router.delete
方法的一些代码示例,展示了Router.delete
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Router.delete
方法的具体详情如下:
包路径:io.vertx.ext.web.Router
类名称:Router
方法名:delete
[英]Add a route that matches any HTTP DELETE request
[中]添加与任何HTTP删除请求匹配的路由
代码示例来源:origin: vert-x3/vertx-examples
});
router.delete("/api/users/:id").handler(ctx -> {
mongo.findOne("users", new JsonObject().put("_id", ctx.request().getParam("id")), null, lookup -> {
代码示例来源:origin: vert-x3/vertx-examples
router.delete("/users/:id").handler(ctx -> {
代码示例来源:origin: wang007/vertx-start
@Override
public io.vertx.ext.web.Route delete() {
return delegate.delete();
}
代码示例来源:origin: org.zalando/vertx-swagger
@Override
public Route delete() {
return router.delete();
}
代码示例来源:origin: org.zalando/vertx-swagger
@Override
public Route delete(String path) {
return router.delete(path);
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testDelete() throws Exception {
router.delete().handler(rc -> rc.response().setStatusMessage("foo").end());
testRequest(HttpMethod.DELETE, "/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.OPTIONS, "/whatever", 404, "Not Found");
testRequest(HttpMethod.HEAD, "/whatever", 404, "Not Found");
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testDeleteWithPathBegin() throws Exception {
router.delete("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end());
testRequest(HttpMethod.DELETE, "/somepath/whatever", 200, "foo");
testRequest(HttpMethod.DELETE, "/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.OPTIONS, "/somepath/whatever", 404, "Not Found");
testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found");
}
代码示例来源:origin: vert-x3/vertx-web
@Test
public void testDeleteWithPathExact() throws Exception {
router.delete("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end());
testRequest(HttpMethod.DELETE, "/somepath/", 200, "foo");
testRequest(HttpMethod.DELETE, "/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.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 any HTTP DELETE request
* @return the route
*/
public io.vertx.rxjava.ext.web.Route delete() {
io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.delete());
return ret;
}
代码示例来源:origin: io.vertx/vertx-rx-java
/**
* Add a route that matches a HTTP DELETE 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 delete(String path) {
io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.delete(path));
return ret;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Add a route that matches any HTTP DELETE request
* @return the route
*/
public io.vertx.rxjava.ext.web.Route delete() {
io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.delete());
return ret;
}
代码示例来源:origin: vert-x3/vertx-rx
/**
* Add a route that matches a HTTP DELETE 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 delete(String path) {
io.vertx.rxjava.ext.web.Route ret = io.vertx.rxjava.ext.web.Route.newInstance(delegate.delete(path));
return ret;
}
代码示例来源:origin: wang007/vertx-start
@Override
public io.vertx.ext.web.Route delete(String path) {
return delegate.delete(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: eclipse/hono
@Override
public void addRoutes(final Router router) {
final String path = String.format("/%s", TenantConstants.TENANT_ENDPOINT);
final BodyHandler bodyHandler = BodyHandler.create();
bodyHandler.setBodyLimit(config.getMaxPayloadSize());
// ADD tenant
router.post(path).handler(bodyHandler);
router.post(path).handler(this::extractRequiredJsonPayload);
router.post(path).handler(this::checkPayloadForTenantId);
router.post(path).handler(this::addTenant);
final String pathWithTenant = String.format("/%s/:%s", TenantConstants.TENANT_ENDPOINT, PARAM_TENANT_ID);
// GET tenant
router.get(pathWithTenant).handler(this::getTenant);
// UPDATE tenant
router.put(pathWithTenant).handler(bodyHandler);
router.put(pathWithTenant).handler(this::extractRequiredJsonPayload);
router.put(pathWithTenant).handler(this::updateTenant);
// REMOVE tenant
router.delete(pathWithTenant).handler(this::removeTenant);
}
代码示例来源:origin: sczyh30/vertx-blueprint-microservice
@Override
public void start(Future<Void> future) throws Exception {
super.start();
Router router = Router.router(vertx);
// body handler
router.route().handler(BodyHandler.create());
// API route handler
router.post(API_SAVE).handler(this::apiSave);
router.get(API_RETRIEVE).handler(this::apiRetrieve);
router.delete(API_CLOSE).handler(this::apiClose);
// get HTTP host and port from configuration, or use default value
String host = config().getString("store.http.address", "0.0.0.0");
int port = config().getInteger("store.http.port", 8085);
createHttpServer(router, host, port)
.compose(serverCreated -> publishHttpEndpoint(SERVICE_NAME, host, port))
.setHandler(future.completer());
}
代码示例来源:origin: io.vertx/vertx-web
@Test
public void testDelete() throws Exception {
router.delete().handler(rc -> rc.response().setStatusMessage("foo").end());
testRequest(HttpMethod.DELETE, "/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.OPTIONS, "/whatever", 404, "Not Found");
testRequest(HttpMethod.HEAD, "/whatever", 404, "Not Found");
}
代码示例来源:origin: io.vertx/vertx-web
@Test
public void testDeleteWithPathExact() throws Exception {
router.delete("/somepath/").handler(rc -> rc.response().setStatusMessage("foo").end());
testRequest(HttpMethod.DELETE, "/somepath/", 200, "foo");
testRequest(HttpMethod.DELETE, "/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.OPTIONS, "/somepath/whatever", 404, "Not Found");
testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found");
}
代码示例来源:origin: io.vertx/vertx-web
@Test
public void testDeleteWithPathBegin() throws Exception {
router.delete("/somepath/*").handler(rc -> rc.response().setStatusMessage("foo").end());
testRequest(HttpMethod.DELETE, "/somepath/whatever", 200, "foo");
testRequest(HttpMethod.DELETE, "/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.OPTIONS, "/somepath/whatever", 404, "Not Found");
testRequest(HttpMethod.HEAD, "/somepath/whatever", 404, "Not Found");
}
代码示例来源:origin: sczyh30/vertx-blueprint-microservice
@Override
public void start(Future<Void> future) throws Exception {
super.start();
final Router router = Router.router(vertx);
// body handler
router.route().handler(BodyHandler.create());
// api route handler
router.post(API_ADD).handler(this::apiAddUser);
router.get(API_RETRIEVE).handler(this::apiRetrieveUser);
router.get(API_RETRIEVE_ALL).handler(this::apiRetrieveAll);
router.patch(API_UPDATE).handler(this::apiUpdateUser);
router.delete(API_DELETE).handler(this::apiDeleteUser);
String host = config().getString("user.account.http.address", "0.0.0.0");
int port = config().getInteger("user.account.http.port", 8081);
// create HTTP server and publish REST service
createHttpServer(router, host, port)
.compose(serverCreated -> publishHttpEndpoint(SERVICE_NAME, host, port))
.setHandler(future.completer());
}
内容来源于网络,如有侵权,请联系作者删除!