1
內部錯誤的詳細信息我實現了一個控制器,處理HTTP錯誤代碼:獲取自定義錯誤頁
class ErrorController {
// 500
def internalserver = {
}
// 504
def timeout = {
}
// 404
def notfound = {
// just testing the values
log.debug "params: ${params}"
log.debug "response: ${response}"
log.debug "url: ${response.redirectURL}"
log.debug "object: ${response.content}"
}
// 403
def forbidden = {
}
}
注意,我已經更新了UrlMappings了。
"500"(controller:'error', action:'internalserver')
"504"(controller:'error', action:'timeout')
"404"(controller:'error', action:'notfound')
"403"(controller:'error', action:'forbidden')
是否有方法可以檢索每個操作中的細節?
即對於404,請求的URL。對於500,異常消息什麼的。
我注意到'響應'對象的類型是http://www.grails.org/doc/latest/api/org/codehaus/groovy/grails/web/util/IncludeResponseWrapper.html。出於某種原因,getContent()始終爲空。有關如何使用該課程的任何提示? – firnnauriel