In a very helpful post by Frank Nimphious, it is explain how to create and declare a custom ADF Controller Exception Handler. Quoting some part below:
- Create a Java class that extends oracle.adf.view.rich.context.ExceptionHandler
- Create a textfile with the name "oracle.adf.view.rich.context.Exceptionhandler" (without the quotes) and store it in .adf\META-INF\services (you need to create the “services” folder)
- In the file, add the absolute name of your custom exception handler class (package name and class name without the “.class” extension)
import oracle.adf.view.rich.context.ExceptionHandler; public class MyCustomExceptionHandler extends ExceptionHandler { public MyCustomExceptionHandler() { super(); } public void handleException(FacesContext facesContext, Throwable throwable, PhaseId phaseId) throws Throwable{ String error_message; error_message = throwable.getMessage(); //check error message and handle it if you can if( … ){ //handle exception … } else{ //delegate to the default ADFc exception handler throw throwable;} } }
No comments:
Post a Comment