简体   繁体   English

是什么触发Grails基于HTTP状态的异常映射?

[英]What triggers Grails HTTP status-based exception mapping?

If I have a UrlMappings.groovy that specifies: 如果我有一个UrlMappings.groovy指定:

"403"(controller: 'error', action: 'status403')

... then I was hoping to trigger this route at runtime by assigning: ...然后我希望通过分配以下内容在运行时触发此路由:

response.status = 403

from within a controller or filter. 从控制器或过滤器内部。 But that doesn't happen. 但这不会发生。 Is there a similarly declarative way for me to "kick a request over" to 403 handling from within a controller or filter? 我是否可以通过类似的声明方式从控制器或过滤器中“发起请求”到403处理?

response.sendError(403)

or 要么

render(status: 403)

See your other question . 看到另一个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM