0
カスタムJSONエラーメッセージをレンダリングしたいと思います。私は、次のしているUrlMappings
クラス内コントローラのGrailsエラー処理
class ErrorController {
static responseFormats = ['json']
def notAuthorized() {
render([error: "You are not authorized to access ${request.getRequestURL()} on this server.",
path: request.getRequestURI()] as JSON)
}
}
:
{"error":"You are not authorized to access http://localhost:8080/error on this server.",
"path":"/error"}
:
"401"(controller: 'error', action: 'notAuthorized')
すべてが、私は次のエラーメッセージをGET http://localhost/path
という事実を除いて、大丈夫働く私は、次のコントローラを作成しました
したがって、request
オブジェクトのURI/URLは、リクエストで指定されたURI/URLを指していません。正しいURI/URLを入手する方法はありますか?