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

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

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

Spark.path介绍

[英]Add a path-prefix to the routes declared in the routeGroup The path() method adds a path-fragment to a path-stack, adds routes from the routeGroup, then pops the path-fragment again. It's used for separating routes into groups, for example: path("/api/email", () -> { ....post("/add", EmailApi::addEmail); ....put("/change", EmailApi::changeEmail); ....etc }); Multiple path() calls can be nested.
[中]为routeGroup中声明的路由添加路径前缀path()方法将路径片段添加到路径堆栈中,添加来自routeGroup的路由,然后再次弹出路径片段。它用于将路由分成组,例如:路径(“/api/email”,()->{…post(“/add”,EmailApi::addEmail);..put(“/change”,EmailApi::changemail);..等等);可以嵌套多个path()调用。

代码示例

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

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

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

@Override
public void setupRoutes() {
  path(controllerBasePath(), () -> {
    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(), () -> {
    get(Routes.PluginImages.PLUGIN_ID_HASH_PATH, this::show);
    head(Routes.PluginImages.PLUGIN_ID_HASH_PATH, this::show);
  });
}

代码示例来源: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::checkAdminUserAnd403);
    get("", this::index, engine);
  });
}

代码示例来源: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("", mimeType, this::setContentType);
    before("", this.mimeType, this.apiAuthenticationHelper::checkAdminUserAnd403);
    get("", this.mimeType, this::show);
  });
}

代码示例来源: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(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("", 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(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::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("/*", 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("", 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);
  });
}

相关文章