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

时间:2011-10-29 09:38:33

标签: java routes playframework

我想在我的Play上设置Google网站管理员!网站通过HTML页面。 谷歌游戏我是一个特定的HTML页面,他们问我放在mydomain.com/someuniquehash.html。

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

获取/someuniqhehash.html staticDir:public / html / someuniquehash.html

然而,当我访问此网址时,我收到了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}

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

1 个答案:

答案 0 :(得分:7)

您需要使用staticFile,而不是staticDir

因此,您的路线应为

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