【发布时间】:2011-02-07 20:08:47
【问题描述】:
我在 grails 1.3.6 中处理 404 HTTP 响应时遇到了一个奇怪的问题(在 1.3.5 中出现了同样的错误行为)。它有时有效,但大多数时候无效。我认为这是一个 grails 错误,但在 grails 的 jira 中没有发现任何错误。 每当我请求错误的 URL 时,我都会收到默认的 Tomcat 404 页面。 我的 Configuration/UrlMappings.groovy 看起来像:
class UrlMappings {
static mappings = {
"404" {
controller = 'customError'
action = 'index'
code = 404
}
"500" {
controller = 'customError'
action = 'index'
code = 500
}
"/"(controller: "home", action: "index")
"/$controller/$action?/$id?"{
constraints {
// id has to be a number
id(matches: /\d+/)
}
}
}
}
有人知道怎么解决吗?:-)
最好, 马特奥
【问题讨论】:
标签: grails