本文整理了Java中spark.Spark.patch()
方法的一些代码示例,展示了Spark.patch()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spark.patch()
方法的具体详情如下:
包路径:spark.Spark
类名称:Spark
方法名:patch
[英]Map the route for HTTP PATCH 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(controllerPath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", mimeType, this::verifyContentType);
before("/*", mimeType, this::verifyContentType);
before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
get("", mimeType, this::show);
put("", mimeType, this::update);
patch("", mimeType, this::bulkUpdate);
});
}
代码示例来源:origin: gocd/gocd
@Override
public void setupRoutes() {
Spark.path(controllerBasePath(), () -> {
before("", mimeType, this::setContentType);
before("/*", mimeType, this::setContentType);
before("", this::verifyContentType);
before("/*", this::verifyContentType);
before("", mimeType, apiAuthenticationHelper::checkNonAnonymousUser);
before("/*", mimeType, apiAuthenticationHelper::checkNonAnonymousUser);
get("", mimeType, this::show);
head("", mimeType, this::show);
patch("", mimeType, this::update);
});
}
代码示例来源: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::checkUserAnd403);
before("", mimeType, this::checkAdminUserAnd403OnlyForPatch);
before("/notification_auth", mimeType, apiAuthenticationHelper::checkUserAnd403);
get("", this::getDataSharingSettings);
patch("", mimeType, this::patchDataSharingSettings);
get("/notification_auth", this::getDataSharingNotificationForCurrentUser);
});
}
代码示例来源: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);
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: mgtechsoftware/smockin
break;
case PATCH:
Spark.patch(path, (req, res) -> processRequest(m, req, res));
break;
default:
代码示例来源:origin: mgtechsoftware/smockin
});
Spark.patch("*", (request, response) -> {
response.status(404);
return "Mock not found";
内容来源于网络,如有侵权,请联系作者删除!