【发布时间】:2013-11-25 01:01:22
【问题描述】:
在将 grails 应用程序从 2.2.2 版本升级到 2.3.2 并最终升级到 2.3.3 后,我注意到一些以前可以工作的链接现在返回 404 状态。
为了说明,这里是示例链接和最初在 v2.2.2 中工作的相应 URL 映射条目:
http://localhost:7080/pages/mytestpage
http://localhost:7080/pages/mytestpage.html
UrlMappings.groovy
static mappings = {
"pages/mytestpage"(controller: 'testController', action: 'testAction')
}
升级后,在给定的链接中,下面的链接不再起作用(即带有.html的链接):
http://localhost:7080/pages/mytestpage.html
解决此问题的一种方法是将 URLMappings 条目更改为如下:
UrlMappings.groovy(修改)
static mappings = {
"pages/mytestpage(.$format)?"(controller: 'testController', action: 'testAction')
}
我的问题是,有没有办法解决这个问题而无需更新 URLMappings 条目?任何能解释这种映射在 2.2.2 版中实际工作的人也将是一个很大的帮助。谢谢!
更新
Using (.html)? 而不是 (.$format)? 在 UrlMappings.groovy 中同样有效,并且已被实际使用。
另外,在这个例子中,应用服务器直接被访问,没有使用网络服务器。
【问题讨论】:
标签: grails grails-2.0