[opencms-dev] OpenCMS: 404-error-handling

Alexander Kandzior alex at opencms.org
Mon Apr 4 19:42:58 CEST 2005


Bernd,

> thanx for throwing me deeper into the code :) I tested it 
> before with another ErrorCode and because of that it did not work.
> Well, now I delved a little bit more.
> Missed the sendError and some other things back and force 
> between OpenCmsCore and OpenCmsServlet.
> Am I correct, when I think it would be good to have a 
> handle500.html too?

I didn't try for the 500 error. Only 404 is handled "nativly" in OpenCms for
sure, for reasons of the static export. IIRC for all other error codes your
must add something into web.xml.

So for a XXX handler, you should add

    <error-page>
      <error-code>XXX</error-code>
      <location>/opencms/system/handler/handleXXX.html</location>
    </error-page> 

> Huuhh. And can you just say yes or no, if it is possible to 
> access the original Exception type in the handle404.html (JSP)?

Not sure about what's available in the JSP and what not. Try accessing the
Java servlet / JSP standard objects for the error handler (see above),
probably located in the request context. These should provide you with all
information required. Didn't try that so far.

It's not unlikley we will add some handlers / pages by default until the 6.0
final is ready. 

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com




More information about the opencms-dev mailing list