You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lance Bader <ld...@gmail.com> on 2008/10/09 17:54:43 UTC

Forwarding an exception to the default HTTP 500 error page

I have a web application that uses a proxy class to exchange information
with an external system.  When this proxy class throws an exception, it
always appears as a cause in some other exception, typically
javax.el.ELException.

I have built a custom error page to handle an exception where the proxy
exception is in the cause chain and I have updated my web.xml so that my
custom error page gets control.

  <error-page>
    <exception-type>
      javax.el.ELException
    </exception-type>
    <location>
      /ViewPOCManagerProxyException.jsp
    </location>
  </error-page>

Everything works fine when the proxy exception is in the cause chain, but I
don't want to handle all the cases were the javax.el.ELException is caused
by something else!  Instead, I want to forward those cases to the existing
Tomcat HTTP 500 error report page.

Imagine my surprise when I discovered that the default HTTP 500 error report
page is implemented as a Tomcat valve, not a servlet or JavaServer page that
I can easily forward to.

I can't be the only person in the world who wants to do something like
this.  I surely don't want to implement a valve to handle my proxy
exceptions.  Is there some way to forward an exception to the default HTTP
500 error page?  Is there a better alternative to handle common exceptions
with a specific cause?

Lance

Re: Forwarding an exception to the default HTTP 500 error page

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lance,

Lance Bader wrote:
> Everything works fine when the proxy exception is in the cause chain, but I
> don't want to handle all the cases were the javax.el.ELException is caused
> by something else!  Instead, I want to forward those cases to the existing
> Tomcat HTTP 500 error report page.

Why not create your own error page and use that throughout your
application? The default Tomcat "500" error page is pretty ugly.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjvcoIACgkQ9CaO5/Lv0PA0nQCgmG8FBMAh1lQGPlcmH4mUIXy6
jV4AoJe/f8gkvSz5GXBxSCmcgbP8caYu
=dZDf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org