1

我有一些包含不同文件的文件夹。我想使用这样的东西:http ://myserver.com/foo/bar/test.html

我正在使用这种方式来获取路径:

"/excursion/$path**" (controller:"excursion", action:"sweet")  

但它对文件扩展名没有帮助......如何禁用文件扩展名截断?

附言

class ExcursionController {
 def defaultAction = "sweet"

 def sweet = {
  render "${params.path}"
 }
}

请求http://myserver.com/excursion/foo/bar/test.html

结果是没有扩展名的“foo/bar/test”:(

4

2 回答 2

2

通过将此行添加到以下内容来禁用文件扩展名截断grails-app/conf/Config.groovy

grails.mime.file.extensions = false

这会影响内容协商,因此我建议您阅读 Grails用户指南的第 7.8 节

于 2010-06-02T08:19:58.330 回答
2

做什么

render "${params.path}.${request.format}"

给你?

于 2010-03-31T12:45:16.203 回答