本文整理了Java中spark.Request.params
方法的一些代码示例,展示了Request.params
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Request.params
方法的具体详情如下:
包路径:spark.Request
类名称:Request
方法名:params
[英]Returns the map containing all route params
[中]
代码示例来源:origin: perwendel/spark
@Override
public String params(String param) {
return delegate.params(param);
}
代码示例来源:origin: perwendel/spark
@Override
public Map<String, String> params() {
return delegate.params();
}
代码示例来源:origin: gocd/gocd
private String requiredParam(final Request req, final String name) {
String value = req.params(name);
if (StringUtils.isBlank(value)) {
throw HaltApiResponses.haltBecauseRequiredParamMissing(name);
}
return value;
}
代码示例来源:origin: gocd/gocd
private String findPipelineGroupName(Request request) {
String groupName = request.params("group_name");
if (StringUtils.isBlank(groupName)) {
groupName = goConfigService.findGroupNameByPipeline(getPipelineNameFromRequest(request));
}
return groupName;
}
代码示例来源:origin: gocd/gocd
private PipelineConfig pipelineConfigFromRequest(Request req) {
final String pipelineName = req.params("pipeline_name");
PipelineConfig pipeline = configService.editablePipelineConfigNamed(pipelineName);
if (null == pipeline) {
throw new RecordNotFoundException(format("Cannot locate pipeline config with name: %s", pipelineName));
}
return pipeline;
}
代码示例来源:origin: gocd/gocd
private CaseInsensitiveString getPipelineNameFromRequest(Request request) {
String pipelineName = request.params("pipeline_name");
if (StringUtils.isBlank(pipelineName)) {
pipelineName = request.queryParams("pipeline_name");
}
return new CaseInsensitiveString(pipelineName);
}
代码示例来源:origin: gocd/gocd
private ConfigRepoConfig repoFromRequest(Request req) {
ConfigRepoConfig repo = service.getConfigRepo(req.params(":id"));
if (null == repo) {
throw HaltApiResponses.haltBecauseNotFound();
}
return repo;
}
代码示例来源:origin: gocd/gocd
public String deleteAgent(Request request, Response response) throws IOException {
final HttpOperationResult result = new HttpOperationResult();
agentService.deleteAgents(currentUsername(), result, singletonList(request.params("uuid")));
return renderHTTPOperationResult(result, request, response);
}
代码示例来源:origin: gocd/gocd
public String usages(Request request, Response response) {
final String elasticProfileId = StringUtils.stripToEmpty(request.params(PROFILE_ID_PARAM));
final Collection<ElasticProfileUsage> jobsUsingElasticProfile = elasticProfileService.getUsageInformation(elasticProfileId);
return ElasticProfileUsageRepresenter.toJSON(jobsUsingElasticProfile);
}
}
代码示例来源:origin: gocd/gocd
public String schedule(Request req, Response res) throws IOException {
HttpOperationResult result = new HttpOperationResult();
String pipelineName = req.params("pipeline_name");
pipelineTriggerService.schedule(pipelineName, getScheduleOptions(req), currentUsername(), result);
return renderHTTPOperationResult(result, req, res);
}
代码示例来源:origin: gocd/gocd
public String destroy(Request req, Response res) throws IOException {
Role role = fetchEntityFromConfig(req.params("role_name"));
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
roleConfigService.delete(SessionUtils.currentUsername(), role, result);
return renderHTTPOperationResult(result, req, res);
}
代码示例来源:origin: gocd/gocd
public void checkViewAccessToTemplateAnd403(Request request, Response response) {
if (!securityService.isSecurityEnabled() || securityService.isUserAdmin(currentUsername())) {
return;
}
String templateName = request.params("template_name");
if (StringUtils.isNotBlank(templateName) && !securityService.isAuthorizedToViewTemplate(new CaseInsensitiveString(templateName), currentUsername())) {
throw renderForbiddenResponse();
}
if (StringUtils.isBlank(templateName) && !securityService.isAuthorizedToViewTemplates(currentUsername())) {
throw renderForbiddenResponse();
}
}
代码示例来源:origin: gocd/gocd
public String triggerOptions(Request request, Response response) throws IOException {
String pipelineName = request.params("pipeline_name");
EnvironmentVariablesConfig variables = goConfigService.variablesFor(pipelineName);
PipelineInstanceModel pipelineInstanceModel = pipelineHistoryService.latest(pipelineName, currentUsername());
TriggerOptions triggerOptions = new TriggerOptions(variables, pipelineInstanceModel);
return writerForTopLevelObject(request, response, writer -> TriggerWithOptionsViewRepresenter.toJSON(writer, triggerOptions));
}
代码示例来源:origin: gocd/gocd
public String show(Request req, Response res) throws IOException {
PipelineTemplateConfig templateConfig = fetchEntityFromConfig(req.params("template_name"));
if (isGetOrHeadRequestFresh(req, templateConfig)) {
return notModified(res);
} else {
setEtagHeader(templateConfig, res);
return writerForTopLevelObject(req, res, writer -> TemplateConfigRepresenter.toJSON(writer, templateConfig));
}
}
代码示例来源:origin: gocd/gocd
private ConfigRepoWithResult repoWithResultFromRequest(Request req) {
ConfigRepoConfig repo = service.getConfigRepo(req.params(":id"));
if (null == repo) {
throw HaltApiResponses.haltBecauseNotFound();
}
PartialConfigParseResult result = dataSource.getLastParseResult(repo.getMaterialConfig());
return new ConfigRepoWithResult(repo, result, isMaterialUpdateInProgress(repo));
}
代码示例来源:origin: gocd/gocd
public String destroy(Request req, Response res) throws IOException {
PipelineConfig existingPipelineConfig = fetchEntityFromConfig(req.params("pipeline_name"));
haltIfPipelineIsDefinedRemotely(existingPipelineConfig);
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
pipelineConfigService.deletePipelineConfig(SessionUtils.currentUsername(), existingPipelineConfig, result);
return renderHTTPOperationResult(result, req, res);
}
代码示例来源:origin: gocd/gocd
public String show(Request req, Response res) throws IOException {
PipelineConfig pipelineConfig = fetchEntityFromConfig(req.params("pipeline_name"));
if (isGetOrHeadRequestFresh(req, pipelineConfig)) {
return notModified(res);
} else {
setEtagHeader(pipelineConfig, res);
return writerForTopLevelObject(req, res, writer -> PipelineConfigRepresenter.toJSON(writer, pipelineConfig));
}
}
代码示例来源:origin: gocd/gocd
String deleteRepo(Request req, Response res) {
ConfigRepoConfig repo = fetchEntityFromConfig(req.params(":id"));
HttpLocalizedOperationResult result = new HttpLocalizedOperationResult();
service.deleteConfigRepo(repo.getId(), currentUsername(), result);
return handleSimpleMessageResponse(res, result);
}
代码示例来源:origin: gocd/gocd
public String show(Request req, Response res) throws IOException {
PipelineConfigs pipelineConfigs = fetchEntityFromConfig(req.params("group_name"));
if (isGetOrHeadRequestFresh(req, pipelineConfigs)) {
return notModified(res);
} else {
setEtagHeader(pipelineConfigs, res);
return writerForTopLevelObject(req, res, writer -> PipelineGroupRepresenter.toJSON(writer, pipelineConfigs));
}
}
代码示例来源:origin: gocd/gocd
public String show(Request req, Response res) throws Exception {
User user = userService.findUserByName(req.params("login_name"));
if (user.equals(new NullUser())) {
throw new RecordNotFoundException();
}
UserToRepresent toRepresent = getUserToRepresent(user, roleConfigService.getRolesForUser(Collections.singletonList(user.getUsername())));
return writerForTopLevelObject(req, res, writer -> UserRepresenter.toJSON(writer, toRepresent));
}
内容来源于网络,如有侵权,请联系作者删除!