]> git.mxchange.org Git - jcore-utils.git/blob - src/org/mxchange/jcoreee/exceptions/CustomExceptionHandlerFactory.java
fixed tpzo
[jcore-utils.git] / src / org / mxchange / jcoreee / exceptions / CustomExceptionHandlerFactory.java
1 /*
2  * Copyright (C) 2016, 2017 Roland Häder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jcoreee.exceptions;
18
19 import javax.faces.context.ExceptionHandler;
20 import javax.faces.context.ExceptionHandlerFactory;
21
22 /**
23  * A custom factory for exception handler. This class is heavily based on this
24  * [1] example.
25  * <p>
26  * 1: https://wmarkito.wordpress.com/2012/04/05/adding-global-exception-handling-using-jsf-2-x-exceptionhandler/
27  * <p>
28  * @author Roland Häder<roland@mxchange.org>
29  */
30 public class CustomExceptionHandlerFactory extends ExceptionHandlerFactory {
31
32         /**
33          * Parent exception handler
34          */
35         private final ExceptionHandlerFactory parent;
36
37         public CustomExceptionHandlerFactory (final ExceptionHandlerFactory parent) {
38                 // Set it here
39                 this.parent = parent;
40         }
41
42         @Override
43         public ExceptionHandler getExceptionHandler () {
44
45                 ExceptionHandler handler = new CustomExceptionHandler(this.parent.getExceptionHandler());
46
47                 return handler;
48         }
49
50 }