spark.Spark.before()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(296)

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

Spark.before介绍

[英]Maps one or many filters to be executed before any matching routes
[中]映射一个或多个要在任何匹配路由之前执行的筛选器

代码示例

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", mimeType, this::setContentType);
    before("", mimeType, authenticationHelper::checkAdminUserAnd403);
    before("", this::verifyContentType);
    before("/*", mimeType, this::setContentType);
    before("/*", mimeType, authenticationHelper::checkAdminUserAnd403);
    before(PREFLIGHT_PATH, this::setMultipartUpload);
    post(PREFLIGHT_PATH, mimeType, this::preflight);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", mimeType, this::setContentType);
    before("/*", mimeType, this::setContentType);
    before("", this::verifyConfirmHeader);
    before("/*", this::verifyConfirmHeader);
    before("", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
    before("/*", mimeType, apiAuthenticationHelper::checkAdminUserAnd403);
    post("", mimeType, this::create);
  });
}

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

@Override
public void setupRoutes() {
  path(Routes.ServerHealthMessages.BASE, () -> {
    before("", this::setContentType);
    before("/*", this::setContentType);
    before("", apiAuthenticationHelper::checkUserAnd403);
    before("/*", apiAuthenticationHelper::checkUserAnd403);
    get("", this::show);
    head("", this::show);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", mimeType, this::setContentType);
    before("/*", mimeType, this::setContentType);
    before("", this::verifyContentType);
    before("/*", this::verifyContentType);
    before(Export.PIPELINES_PATH, mimeType, apiAuthenticationHelper::checkPipelineGroupAdminUserAnd403);
    get(Export.PIPELINES_PATH, mimeType, this::exportPipeline);
    exception(RecordNotFoundException.class, this::notFound);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", this::setContentType);
    before("/*", this::setContentType);
    before("", mimeType, apiAuthenticationHelper::checkPipelineGroupOperateUserAnd403);
    before("/*", mimeType, apiAuthenticationHelper::checkPipelineGroupOperateUserAnd403);
    get("", this::search);
    head("", this::search);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", this::setContentType);
    before("/*", this::setContentType);
    before("", mimeType, apiAuthenticationHelper::checkAdminUserOrGroupAdminUserAnd403);
    before("/*", mimeType, apiAuthenticationHelper::checkAdminUserOrGroupAdminUserAnd403);
    get(Routes.ElasticProfileAPI.ID + Routes.ElasticProfileAPI.USAGES, mimeType, this::usages);
    exception(RecordNotFoundException.class, this::notFound);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerPath(), () -> {
    before("", mimeType, this::setContentType);
    before("", this::verifyContentType);
    before("", apiAuthenticationHelper::checkUserAnd403);
    get("", mimeType, this::index);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerPath(), () -> {
    before("", mimeType, this::setContentType);
    before("", this::verifyContentType);
    before("", apiAuthenticationHelper::checkUserAnd403);
    get("", mimeType, this::index);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", mimeType, this::setContentType);
    before("/*", mimeType, this::setContentType);
    before("", this::verifyContentType);
    before("/*", this::verifyContentType);
    get(Routes.PipelineSelection.PIPELINES_DATA, mimeType, this::pipelinesData);
    get("", mimeType, this::show);
    put("", mimeType, this::update);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", mimeType, this::setContentType);
    before("", this.mimeType, this.apiAuthenticationHelper::checkAdminUserAnd403);
    get("", this.mimeType, this::show);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserAnd403);
    get("", this::index, engine);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserAnd403);
    get("", this::index, engine);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserAnd403);
    get("", this::index, engine);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserOrGroupAdminUserAnd403);
    get("", this::index, engine);
  });
}

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

public void init() {
  before("/*", (request, response) -> request.attribute(TIMER_START, new RuntimeHeaderEmitter(request, response)));
  before("/*", (request, response) -> response.header("Cache-Control", "max-age=0, private, must-revalidate"));
  controllers.forEach(SparkSpringController::setupRoutes);
  sparkControllers.forEach(SparkController::setupRoutes);
  exception(JsonParseException.class, this::invalidJsonPayload);
  exception(UnprocessableEntityException.class, this::unprocessableEntity);
  afterAfter("/*", (request, response) -> request.<RuntimeHeaderEmitter>attribute(TIMER_START).render());
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkUserAnd403);
    get("", this::index, engine);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserAnd403);
    get("", this::index, templateEngine);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserOrGroupAdminUserAnd403);
    get("", this::index, engine);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserAnd403);
    get("", this::index, engine);
  });
}

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    before("", authenticationHelper::checkAdminUserAnd403);
    get("", this::index, engine);
  });
}

相关文章