本文整理了Java中spark.Spark.delete()
方法的一些代码示例,展示了Spark.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spark.delete()
方法的具体详情如下:
包路径:spark.Spark
类名称:Spark
方法名:delete
[英]Map the route for HTTP DELETE requests
[中]映射HTTP删除请求的路由
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", this::setContentType);
before("/*", this::setContentType);
before("", mimeType, this::checkSecurityOr403);
before("/*", mimeType, this::checkSecurityOr403);
get("", mimeType, this::index);
get(Routes.AgentsAPI.UUID, mimeType, this::show);
patch(Routes.AgentsAPI.UUID, mimeType, this::update);
patch("", mimeType, this::bulkUpdate);
delete(Routes.AgentsAPI.UUID, mimeType, this::deleteAgent);
delete("", mimeType, this::bulkDeleteAgents);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this::verifyContentType);
before("/*", this::verifyContentType);
before("", this.mimeType, this.apiAuthenticationHelper::checkAdminUserAnd403);
before("/*", this.mimeType, this.apiAuthenticationHelper::checkAdminUserAnd403);
get("", this.mimeType, this::index);
post("", this.mimeType, this::create);
delete("", this.mimeType, this::bulkDelete);
get(Routes.Users.USER_NAME, this.mimeType, this::show);
patch(Routes.Users.USER_NAME, this.mimeType, this::patchUser);
delete(Routes.Users.USER_NAME, this.mimeType, this::deleteUser);
patch(Routes.Users.USER_STATE, this.mimeType, this::bulkUpdateUsersState);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", this::setContentType);
before("/*", this::setContentType);
before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
get("", this::index);
get(Routes.ArtifactStoreConfig.ID, this::show);
post("", this::create);
put(Routes.ArtifactStoreConfig.ID, this::update);
delete(Routes.ArtifactStoreConfig.ID, this::destroy);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", this::setContentType);
before("/*", this::setContentType);
before("", mimeType, apiAuthenticationHelper::checkAdminUserOrGroupAdminUserAnd403);
before("/*", mimeType, apiAuthenticationHelper::checkAdminUserOrGroupAdminUserAnd403);
get("", mimeType, this::index);
get(Routes.ElasticProfileAPI.ID, mimeType, this::show);
post("", mimeType, this::create);
put(Routes.ElasticProfileAPI.ID, mimeType, this::update);
delete(Routes.ElasticProfileAPI.ID, mimeType, this::destroy);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerPath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this::verifyContentType);
before("/*", this::verifyContentType);
before("", mimeType, apiAuthenticationHelper::checkPipelineCreationAuthorizationAnd403);
before(Routes.PipelineConfig.NAME, mimeType, apiAuthenticationHelper::checkPipelineGroupAdminUserAnd403);
post("", mimeType, this::create);
get(Routes.PipelineConfig.NAME, mimeType, this::show);
put(Routes.PipelineConfig.NAME, mimeType, this::update);
delete(Routes.PipelineConfig.NAME, mimeType, this::destroy);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", this::setContentType);
before("/*", this::setContentType);
before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
get("", mimeType, this::index);
get(Routes.Environments.NAME, mimeType, this::show);
post("", mimeType, this::create);
put(Routes.Environments.NAME, mimeType, this::update);
patch(Routes.Environments.NAME, this::partialUpdate);
delete(Routes.Environments.NAME, this::remove);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerPath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this::verifyContentType);
before("/*", this::verifyContentType);
before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
get("", mimeType, this::index);
post("", mimeType, this::create);
get(Routes.Roles.NAME_PATH, mimeType, this::show);
put(Routes.Roles.NAME_PATH, mimeType, this::update);
delete(Routes.Roles.NAME_PATH, mimeType, this::destroy);
exception(InvalidPluginTypeException.class, (ex, req, res) -> {
res.body(this.messageJson(ex));
res.status(HttpStatus.BAD_REQUEST.value());
});
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerPath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this::verifyContentType);
before("/*", this::verifyContentType);
before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
before(Routes.PipelineGroupsAdmin.NAME_PATH, mimeType, apiAuthenticationHelper::checkPipelineGroupAdminUserAnd403);
get("", mimeType, this::index);
post("", mimeType, this::create);
get(Routes.PipelineGroupsAdmin.NAME_PATH, mimeType, this::show);
put(Routes.PipelineGroupsAdmin.NAME_PATH, mimeType, this::update);
delete(Routes.PipelineGroupsAdmin.NAME_PATH, mimeType, this::destroy);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerBasePath(), () -> {
before("", mimeType, this::setContentType);
before("", mimeType, authHelper::checkAdminUserAnd403);
before("", this::verifyContentType);
before("/*", mimeType, this::setContentType);
before("/*", mimeType, authHelper::checkAdminUserAnd403);
before("/*", this::verifyContentType);
get(ConfigRepos.INDEX_PATH, mimeType, this::index);
get(ConfigRepos.REPO_PATH, mimeType, this::showRepo);
post(ConfigRepos.CREATE_PATH, mimeType, this::createRepo);
put(ConfigRepos.UPDATE_PATH, mimeType, this::updateRepo);
delete(ConfigRepos.DELETE_PATH, mimeType, this::deleteRepo);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerPath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this::verifyContentType);
before("/*", this::verifyContentType);
before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
get("", mimeType, this::index);
post("", mimeType, this::create);
patch("", mimeType, this::bulkUpdate);
get(Routes.Roles.NAME_PATH, mimeType, this::show);
put(Routes.Roles.NAME_PATH, mimeType, this::update);
delete(Routes.Roles.NAME_PATH, mimeType, this::destroy);
exception(InvalidPluginTypeException.class, (ex, req, res) -> {
res.body(this.messageJson(ex));
res.status(HttpStatus.BAD_REQUEST.value());
});
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
path(controllerPath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this::verifyContentType);
before("/*", this::verifyContentType);
before("", mimeType, onlyOn(apiAuthenticationHelper::checkAdminUserOrGroupAdminUserAnd403, "POST"));
before("", mimeType, onlyOn(apiAuthenticationHelper::checkViewAccessToTemplateAnd403, "GET", "HEAD"));
before(Routes.PipelineTemplateConfig.NAME, mimeType, onlyOn(apiAuthenticationHelper::checkViewAccessToTemplateAnd403, "GET", "HEAD"));
before(Routes.PipelineTemplateConfig.NAME, mimeType, onlyOn(apiAuthenticationHelper::checkAdminOrTemplateAdminAnd403, "PUT", "PATCH", "DELETE"));
get("", mimeType, this::index);
post("", mimeType, this::create);
get(Routes.PipelineTemplateConfig.NAME, mimeType, this::show);
put(Routes.PipelineTemplateConfig.NAME, mimeType, this::update);
delete(Routes.PipelineTemplateConfig.NAME, mimeType, this::destroy);
exception(RecordNotFoundException.class, this::notFound);
});
}
代码示例来源:origin: bwssytems/ha-bridge
}, new JsonTransformer());
delete (API_CONTEXT + "/:id", "application/json", (request, response) -> {
String anId = request.params(":id");
log.debug("Delete a device: " + anId);
代码示例来源:origin: com.rapatao.sparkjava/spark-spring-core
@Override
public void registry(String path, Route route) {
Spark.delete(path, route);
}
},
代码示例来源:origin: bwssytems/ha-bridge
delete(HUE_CONTEXT + "/:userid/groups/:groupid", "application/json", (request, response) -> {
response.header("Access-Control-Allow-Origin", request.headers("Origin"));
response.type("application/json");
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
/**
* Creates a controller that maps requests to actions.
*/
public UserController(final UserService userService) {
Spark.staticFileLocation("/public");
get("/api/users", (req, res) -> userService.getAllUsers(), json());
get("/api/users/:id", (req, res) -> userService.getUser(req.params(":id")), json());
post("/api/users",
(req, res) -> userService.createUser(req.queryParams("name"), req.queryParams("email")),
json());
put("/api/users/:id", (req, res) -> userService.updateUser(
req.params(":id"),
req.queryParams("name"),
req.queryParams("email")
), json());
delete("/api/users/:id", (req, res) -> userService.deleteUser(req.params(":id")), json());
after((req, res) -> {
res.type("application/json");
});
exception(IllegalArgumentException.class, (error, req, res) -> {
res.status(400);
res.body(toJson(new ResponseError(error)));
});
}
代码示例来源:origin: lamarios/Homedash2
@Override
public void defineEndpoints() {
/**
* gets all pages as json
*/
Spark.get("/pages", (req, res) -> getAll(), gson::toJson);
/**
* add a pages and return the whole list of pages as json
*/
Spark.post("/pages/add", this::addPage, gson::toJson);
/**
* Rename a page
*/
Spark.post("/pages/edit/:id", this::renamePage, gson::toJson);
/**
* deleete a page and return all as json
*/
Spark.delete("/page/:id", this::deletePage, gson::toJson);
}
代码示例来源:origin: cagataygurturk/lambadaframework
delete(getSparkPath(fullPath), this::handle);
代码示例来源:origin: mgtechsoftware/smockin
break;
case DELETE:
Spark.delete(path, (req, res) -> processRequest(m, req, res));
break;
case PATCH:
代码示例来源:origin: lamarios/Homedash2
public void defineEndpoints() {
/*
* Add module
*/
Spark.get("/add-module/on-page/:page", this::addModuleOnPage, new HomeDashTemplateEngine());
/*
* Add module with class This will save the module if there are no
* settings to display, otherwise it'll show the settings
*/
Spark.get("/add-module/:pluginclass", this::addModule, new HomeDashTemplateEngine());
/*
* Add module
*/
Spark.get("/module/:moduleId/settings", this::getModuleSettings, new HomeDashTemplateEngine());
/*
* Save a new or edited module
*/
Spark.post("/save-module", this::saveModule, new HomeDashTemplateEngine());
/*
* Deletes a module
*/
Spark.delete("/module/:moduleId", this::deleteModule);
/**
* Gets the available sizes for a module's plugin
*/
Spark.get("/module/:id/availableSizes", this::getModuleSizes, gson::toJson);
Spark.get("/module/:moduleId/move-to-page/:pageId", this::moveModule, gson::toJson);
Spark.get("/module/:moduleId/full-screen", this::getFullScreenView, new HomeDashTemplateEngine());
Spark.post("/module/getNextAvailableSize", this::getNextAvailableSize);
}
代码示例来源:origin: ikidou/Retrofit2Demo
Spark.put("/blog/:id", BlogHandler.PUT, GsonTransformer.getDefault());
Spark.delete("/blog", BlogHandler.DELETE, GsonTransformer.getDefault());
Spark.delete("/blog/:id", BlogHandler.DELETE, GsonTransformer.getDefault());
内容来源于网络,如有侵权,请联系作者删除!