【问题标题】:response.sendError(404) creates empty page in grailsresponse.sendError(404) 在 grails 中创建空页面
【发布时间】:2017-07-30 11:09:17
【问题描述】:

在少数控制器/动作的 grails 应用程序中,response.sendError(404) 正在正确呈现映射页面(在 UrlMappings.groovy 中映射的 404 页面)。但对于某些操作,它显示空白页面。

我尝试查看日志,发现如下错误: o.s.boot.web.support.ErrorPageFilter - 由于响应已提交,因此无法转发到请求的错误页面 [/guitar/adfsalf]。因此,响应可能具有错误的状态代码。如果您的应用程序在 WebSphere Application Server 上运行,您可以通过将 com.ibm.ws.webcontainer.invokeFlushAfterService 设置为 false 来解决此问题。

您能帮我找到根本原因和更好的解决方案吗?

谢谢,

【问题讨论】:

  • 你使用的是什么版本的 Grails?
  • 嗨,Joe,我们使用的是 grails 3.2.3。
  • 您能发布您的 URL 映射吗?
  • "404"(view:'/dummy/notFound')

标签: grails


【解决方案1】:

改为render(status: 404)

【讨论】:

    【解决方案2】:

    渲染状态:404,查看:'/errors/notFound' 返回; 上面的代码对我有用。但我想知道为什么 response.sendError(404) 每次都不起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-22
      • 2022-11-13
      • 1970-01-01
      • 2017-07-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多