In the Jboss Seam application, how can I make sure that every exception results in a custom error page?

I already have the following declared in my pages.xml:

<exception> 
    <http-error error-code="500" />
</exception>

and this is in my web.xml:

<error-page>
    <error-code>500</error-code>
    <location>/error500.html</location>
</error-page>

However, sometimes when an exception is thrown, I get a debug page even when it is in production. I read here that if an exception occurs during the RENDER_RESPONSE phase, redirection cannot occur because the response has already been sent. I have two questions:

  • How to determine if an exception was excluded at this stage?
  • Is it possible to display a custom error page regardless of where the exception is thrown? If so, how can I do this?
+3
3

, , debug false.

facelets, , debots false.

<context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>false</param-value>
</context-param>

<core:init debug="false" jndi-pattern="somepattern"/>

Init.instance().isDebug() false

, pages.xml

<exception>
    <redirect view-id="/error.xhtml">
        <message severity="error">Error</message>
    </redirect>
</exception>
+1

.

+2

, debug false components.xml

<core:init debug="false" jndi-pattern="n2/#{ejbName}/local"/>

+1

Source: https://habr.com/ru/post/1775886/


All Articles