加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – 使用Play映射特定的文件路由!骨架

发布时间:2020-12-15 08:44:46 所属栏目:Java 来源:网络整理
导读:我想在我的Play上设置Google网站管理员!网站通过 HTML页面. 谷歌游戏我一个特定的HTML页面,他们问我放在mydomain.com/someuniquehash.html. 我把文件放在我的应用程序的public / html文件夹中,我尝试将此规则添加到Play!的路径文件中: GET /someuniqhehas
我想在我的Play上设置Google网站管理员!网站通过 HTML页面.
谷歌游戏我一个特定的HTML页面,他们问我放在mydomain.com/someuniquehash.html.

我把文件放在我的应用程序的public / html文件夹中,我尝试将此规则添加到Play!的路径文件中:

GET /someuniqhehash.html staticDir:public / html / someuniquehash.html

然而,当我访问此URL时,我得到404:

These routes have been tried,in this order :

GET       /@documentation/cheatsheet/{category}             PlayDocumentation.cheatSheet
GET       /@documentation/modules/{module}/files/{name}     PlayDocumentation.file
GET       /@documentation/modules/{module}/images/{name}    PlayDocumentation.image
GET       /@documentation/modules/{module}/{id}             PlayDocumentation.page
GET       /@documentation/files/{name}                      PlayDocumentation.file
GET       /@documentation/images/{name}                     PlayDocumentation.image
GET       /@documentation/{id}                              PlayDocumentation.page
GET       /@documentation/?                                 PlayDocumentation.index
GET       /                                                 Application.index
GET       /someuniquehash.html/                     staticDir:public/html/someuniquehash.html
GET       /favicon.ico                                      404
GET       /public/                                          staticDir:public
GET       /{action}                                         Application.{action}
*         /{controller}/{action}                            {controller}.{action}

如何为此特定静态文件配置路由?

解决方法

您需要使用staticFile,而不是staticDir.

因此你的路线应该是

GET     /someuniquehash.html         staticFile:/public/html/someuniquehash.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读