Java 使用Play映射特定的文件路径!框架

Java 使用Play映射特定的文件路径!框架,java,routes,playframework,Java,Routes,Playframework,我想在我的游戏中设置谷歌网站管理员!网站通过一个HTML页面。 Google game给了我一个特定的html页面,他们要求我把它放在mydomain.com/someuniquehash.html上 我把文件放在我的应用程序的public/html文件夹中,我尝试添加这个规则来播放s路由文件: GET/someuniqhehash.html staticDir:public/html/someuniquehash.html 然而,当我访问这个URL时,我得到一个404: These route

我想在我的游戏中设置谷歌网站管理员!网站通过一个HTML页面。 Google game给了我一个特定的html页面,他们要求我把它放在mydomain.com/someuniquehash.html上

我把文件放在我的应用程序的
public/html
文件夹中,我尝试添加这个规则来播放s路由文件:

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

如何在模板中指向此/someuniquehash.html?我现在使用${play.play.configuration.getProperty(“application.baseUrl”)}/。。。但是应该有一种更干净的方法?与指向任何静态内容的方法完全相同。但是,我最终得到的是“GET/public/staticDir:public”url,而不是我的“GET/termsofservice staticFile:/public/tos.txt”@{public/tos.txt'}->…/public/tos.txt而不是…/termsofservice,即使在通用公共路由之前定义了/termsofservice路由