Orbeon Error Handling

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Orbeon Error Handling

Jonathan J Wright
Hi,
 
I'm trying to work out how to implement / configure consistent error handling at the container (tomcat) level. I have an <error-page> element in my web.xml that catches everything java.lang.Thorwable and redirects to my standard error page.
 
How do I configure OPS to propogate exceptions up to the container level. For example, I currently have the following problem:
 
<xforms:submission ... action="some-struts-action" replace="all"/>
 
When submitted the struts action thorws an exception, for which there is no declared handler. I would have thought this exception would then be handled by the container as the replace attribute is set to all. Orbeon, however, is still handling the exception. How can I switch Orbeon exception handling off? Is it as simple as writing my own processor that does nothing more than log and rethrow the exception?
 
Thanks in advance,
 
Jonathan Wright
 


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Orbeon Error Handling

Jonathan J Wright
Background
 
A web application uses OPS to handle some, but not all, client requests. When an exception is thrown users should be shown a consistent error page.
 
Problem
 
How do you switch off OPS's exception handling so that exceptions can propogate upto the container where a declarative <error-page> exception handling policy can be used?
 
The simple answer would appear to be that you cannot switch off OPS's exception handling. Removing the error processor configurations for the OPSServlet's in web.xml doesn't stop OPS from catching exceptions.
 
This kind of makes sense because you still need a catch all safety net for any exceptions that may get thrown during error processing.This 'catch all' code is located in the org.orbeon.oxf.webapp.ProcessorService serviceStaticError() method. serviceStaticError() is a private method that simply writes some hardcoded HTML to the response.
 
Solution
 
The simplest solution is to create your own error pipeline that does nothing more than a server-side redirect to your global error page, for example:
 
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
              xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
              xmlns:xs="http://www.w3.org/2001/XMLSchema"
              xmlns:oxf="http://www.orbeon.com/oxf/processors">
    <p:processor name="oxf:redirect" xmlns:p="http://www.orbeon.com/oxf/pipeline">
        <p:input name="data">
            <redirect-url>
                <server-side>true</server-side>
                <path-info>/global-error.jsp</path-info>
            </redirect-url>
        </p:input>
    </p:processor>
</p:config>
 
This isn't ideal as it results in duplicate code (web.xml and your-new-error.xpl). If you really felt the need to you could write your own Processor implementation to parse web.xml during initiation. You may also want to write a custom processor if your error page relys on the exception being stored in the javax.servlet.error.exception request attribute.
 
Jonathan
 
Skype: jonathan.j.wright


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws