org.jooby.Router.assets()方法的使用及代码示例

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

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

Router.assets介绍

[英]Static files handler.

assets("/assets/**");

Resources are served from root of classpath, for example GET /assets/file.js will be resolve as classpath resource at the same location. The AssetHandler one step forward and add support for serving files from a CDN out of the box. All you have to do is to define a assets.cdn property:

assets.cdn = "http://d7471vfo50fqt.cloudfront.net"

A GET to /assets/js/index.js will be redirected to: http://d7471vfo50fqt.cloudfront.net/assets/js/index.js. You can turn on/off ETag and Last-Modified headers too using assets.etag and assets.lastModified. These two properties are enabled by default.
[中]静态文件处理程序

assets("/assets/**");

资源是从类路径的根提供的,例如GET /assets/file.js将被解析为同一位置的类路径资源。AssetHandler向前迈出了一步,并添加了对从CDN即用即用服务文件的支持。你需要做的就是定义一个assets.cdn属性:

assets.cdn = "http://d7471vfo50fqt.cloudfront.net"

到达/assets/js/index.js的路径将被重定向到:[$3$]。您也可以使用assets.etagassets.lastModified打开/关闭ETagLast-Modified标题。默认情况下,这两个属性处于启用状态。

代码示例

代码示例来源:origin: jooby-project/jooby

return assets(path, "/");

代码示例来源:origin: jooby-project/jooby

router.assets("/livereload.js", livereloadjs);

代码示例来源:origin: jooby-project/jooby

String path = conf.getString("crash.webshell.path");
String title = conf.getString("application.name") + " shell";
routes.assets(path + "/css/**", "META-INF/resources/css/{0}");
routes.assets(path + "/js/**", "META-INF/resources/js/{0}");
String rootpath = Route.normalize(conf.getString("application.path") + path);

代码示例来源:origin: jooby-project/jooby

router.assets(staticPath + "**", SWAGGER_STATIC + "{0}");
router.assets(staticPath + "**", SWAGGER_THEME + "{0}");
  .format(REDOC, conf.getString("swagger.info.title"), swaggerJsonPath, redocjsfull);
router.assets(options.redoc + redocjs, "/redoc/" + redocjs);
router.get(options.redoc, () -> Results.ok(redoc).type(MediaType.html));

代码示例来源:origin: jooby-project/jooby

router.assets(options.path + "/static/**", RAML_STATIC + "{0}");

代码示例来源:origin: org.jooby/jooby

return assets(path, "/");

代码示例来源:origin: org.jooby/jooby-apitool

router.assets(staticPath + "**", SWAGGER_STATIC + "{0}");
router.assets(staticPath + "**", SWAGGER_THEME + "{0}");
  .format(REDOC, conf.getString("swagger.info.title"), swaggerJsonPath, redocjsfull);
router.assets(options.redoc + redocjs, "/redoc/" + redocjs);
router.get(options.redoc, () -> Results.ok(redoc).type(MediaType.html));

代码示例来源:origin: org.jooby/jooby-apitool

router.assets(options.path + "/static/**", RAML_STATIC + "{0}");

相关文章