Tuesday, August 18, 2015

ADF Error Handling

Exceptions are thrown in different places or layers of the ADF application. ADF framework allow applications to register general error handlers on different layers. 



Task Flow Error Handling

Create a task flow called base-taskflow-template.xml. 

In base-taskflow-template.xml, 
  • create a bean class TashFlowErrorHandler. In the class, create a method called 
public void handleException() {//add handling logic}
  • add it to base-taskflow-template.xml as request scope.
  • add a method-call named ErrorHandler, marked it as Exception Handler.
All task flows extend base-taskflow-template.xml. So exceptions are handled by the registered handler.



Bean Exception Handling

When the ADF view layer calls a method from a managed bean and this method throws an exception, the default ADFExceptionHandler is called. To override the default behavior,  

Create class BeanExceptionHandler
public class BeanExceptionHandler extends ExceptionHandler

To register the exception handler, create a file called "oracle.adf.view.rich.context.ExceptionHandler"
add text (class full qualified name) in the file:

com.abc.view.util.BeanExceptionHandler

put this file in master application (deployed as ear file) under folder below (create if doesn't exist)

.adf\META-INF\services




Binding Error Handler

Managed bean may call Application Module methods by DataControls. Such calls use the bindings which are handled by the DataBindings.cpx mainly. 

Create a class called 
public class BindingErrorHandler extends DCErrorHandlerImpl

In master application DataBindings.cpx, we define the ErrorHandlerClass="com.abc.view.util.BindingErrorHandler




No comments:

Post a Comment