Grails:URL映射 - 如何传递文件扩展名? [英] Grails: URL mapping - how to pass file extension?
本文介绍了Grails:URL映射 - 如何传递文件扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用这样的东西: http://myserver.com/foo/ bar / test.html
我使用这种方式获取路径:
/ excursion / $ path **(controller:excursion,action:sweet)
但是它对文件扩展名没有帮助...如何禁用文件扩展名截断?
p
类ExcursionController {
def defaultAction = sweet
def sweet = {
render$ {params.path}
}
}
要求 http: //myserver.com/excursion/foo/bar/test.html
结果是foo / bar / test,没有扩展名:(
解决方案 渲染$ {params.path}。$ {request.format}
给你吗? p>
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 :(
解决方案
what does
render "${params.path}.${request.format}"
give you?
这篇关于Grails:URL映射 - 如何传递文件扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文