Grails 如何更换玻璃鱼';默认错误页?

Grails 如何更换玻璃鱼';默认错误页?,grails,glassfish,Grails,Glassfish,我正在编写Grails应用程序,它有时会以422 http状态代码(在无效的AJAX调用上)响应。在Glassfish上部署时,容器在视图呈现文本后包含默认错误页 如何改变这种行为 问候,, Tarmo在web.xml中添加元素应该可以: <error-page> <error-code>422</error-code> <location>location_of_your_custom_error_page</location>

我正在编写Grails应用程序,它有时会以422 http状态代码(在无效的AJAX调用上)响应。在Glassfish上部署时,容器在视图呈现文本后包含默认错误页

如何改变这种行为

问候,, Tarmo

在web.xml中添加
元素应该可以:

<error-page>
  <error-code>422</error-code>
  <location>location_of_your_custom_error_page</location>
</error-page> 
编辑

在web.xml中添加
元素应该可以:

<error-page>
  <error-code>422</error-code>
  <location>location_of_your_custom_error_page</location>
</error-page> 
编辑


在Grails应用程序中,您可以通过在
Grails app/conf/UrlMappings.groovy
中创建响应代码URL映射来配置错误代码映射。这个URL映射可以让您


在Grails应用程序中,您可以通过在
Grails app/conf/UrlMappings.groovy
中创建响应代码URL映射来配置错误代码映射。这个URL映射可以让您


如果要为整个域更改它(下面的解决方案仅适用于特定的应用程序上下文),则需要调整domain.xml

...
 <config name="server-config">
 <http-service>
 <access-log />
 <virtual-server id="server" network-listeners="http-listener-2,http-listener-1">
 <property name="send-error_1" value="code=404 path=/tmp/404.html reason=Resource_not_found" />
 </virtual-server>
 <virtual-server id="__asadmin" network-listeners="admin-listener" />
 </http-service>
...
。。。

)

如果要为整个域更改它(下面的解决方案仅适用于特定的应用程序上下文),则需要调整domain.xml

...
 <config name="server-config">
 <http-service>
 <access-log />
 <virtual-server id="server" network-listeners="http-listener-2,http-listener-1">
 <property name="send-error_1" value="code=404 path=/tmp/404.html reason=Resource_not_found" />
 </virtual-server>
 <virtual-server id="__asadmin" network-listeners="admin-listener" />
 </http-service>
...
。。。
)

...
 <config name="server-config">
 <http-service>
 <access-log />
 <virtual-server id="server" network-listeners="http-listener-2,http-listener-1">
 <property name="send-error_1" value="code=404 path=/tmp/404.html reason=Resource_not_found" />
 </virtual-server>
 <virtual-server id="__asadmin" network-listeners="admin-listener" />
 </http-service>
...