Grails:URL 映射 - 如何传递文件扩展名?
我有一些包含不同文件的文件夹。 我想使用这样的东西:http://myserver.com/foo/bar/test。 html
我使用这种方式获取路径:
"/excursion/$path**" (controller:"excursion", action:"sweet")
但它对文件扩展名没有帮助...如何禁用文件扩展名截断?
PS
class ExcursionController {
def defaultAction = "sweet"
def sweet = {
render "${params.path}"
}
}
请求 http://myserver.com/excursion/foo/bar/test.html< /a>
结果是“foo/bar/test”,没有扩展名:(
I have some folder with different files.
I want to use something like this: http://myserver.com/foo/bar/test.html
I'm using this way to obtain path:
"/excursion/$path**" (controller:"excursion", action:"sweet")
But it doesn't helps with file extensions... How to disable file extensions truncating ?
P.S.
class ExcursionController {
def defaultAction = "sweet"
def sweet = {
render "${params.path}"
}
}
Request http://myserver.com/excursion/foo/bar/test.html
The result is "foo/bar/test" with no extension :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
什么?
给你
what does
give you?
通过将此行添加到
grails-app/conf/Config.groovy
来禁用文件扩展名截断:这会影响内容协商,因此我建议您阅读 Grails 用户指南
Disable file extension truncation by adding this line to
grails-app/conf/Config.groovy
:This impacts content negotiation, so I suggest you read section 7.8 of the Grails user guide