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

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

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

Spark.externalStaticFileLocation介绍

[英]Sets the external folder serving static files. Observe: this method must be called before all other methods.
[中]

代码示例

代码示例来源:origin: neo4j-examples/neo4j-movies-java-bolt

public static void main(String[] args) {
    setPort(Util.getWebPort());
    externalStaticFileLocation("src/main/webapp");
    final MovieService service = new MovieService(Util.getNeo4jUrl());
    new MovieRoutes(service).init();
  }
}

代码示例来源:origin: vqtran/EchoQuery

private static void runSparkServer() {
  Spark.externalStaticFileLocation("public/");

  Spark.get("/user/:id", (request, response) ->
    new ModelAndView(new HashMap<>(), "index.jade"),
    new JadeTemplateEngine());

  Spark.get("/fetch/:id", (request, response) ->
    VisualizationUtil.getUserData(request.params(":id")).toString());

  Spark.get("/fetch/", (request, response) -> "Enter a valid User ID");
  Spark.get("/login/:id", (request, response) -> 
    new LoginHandler(request, response).respond());
  Spark.post("/submit/:id", (request, response) -> 
    new SubmitHandler(request, response).respond());
 }
}

相关文章