gluu
公開メンバ関数 | 限定公開メンバ関数 | 関数 | 非公開メンバ関数 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.gluu.oxtrust.exception.GlobalExceptionHandler クラス
org.gluu.oxtrust.exception.GlobalExceptionHandler の継承関係図
Inheritance graph
org.gluu.oxtrust.exception.GlobalExceptionHandler 連携図
Collaboration graph

公開メンバ関数

ExceptionHandler getWrapped ()
 
void handle () throws FacesException
 

限定公開メンバ関数

void storeRequestURI ()
 

関数

 GlobalExceptionHandler (ExceptionHandler exception)
 

非公開メンバ関数

boolean isSecurityException (Throwable t)
 
boolean isConversationException (Throwable t)
 
boolean isViewExpiredException (Throwable t)
 
void performRedirect (ExternalContext externalContext, String viewId)
 

非公開変数類

ExceptionHandler wrapped
 

静的非公開変数類

static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class)
 

詳解

Created by eugeniuparvan on 5/23/17.

構築子と解体子

◆ GlobalExceptionHandler()

org.gluu.oxtrust.exception.GlobalExceptionHandler.GlobalExceptionHandler ( ExceptionHandler  exception)
inlinepackage
30  {
31  this.wrapped = exception;
32  }
ExceptionHandler wrapped
Definition: GlobalExceptionHandler.java:28

関数詳解

◆ getWrapped()

ExceptionHandler org.gluu.oxtrust.exception.GlobalExceptionHandler.getWrapped ( )
inline
35  {
36  return this.wrapped;
37  }
ExceptionHandler wrapped
Definition: GlobalExceptionHandler.java:28

◆ handle()

void org.gluu.oxtrust.exception.GlobalExceptionHandler.handle ( ) throws FacesException
inline
39  {
40  final Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
41 
42  while (i.hasNext()) {
43  ExceptionQueuedEvent event = i.next();
44  ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
45 
46  Throwable t = context.getException();
47  final FacesContext fc = FacesContext.getCurrentInstance();
48  final ExternalContext externalContext = fc.getExternalContext();
49  final ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler();
50  try {
51  if (isSecurityException(t)) {
52  performRedirect(externalContext, "/login");
53  } else if (isConversationException(t)) {
54  log.error(t.getMessage(), t);
55  performRedirect(externalContext, "/conversation_error");
56  } if (isViewExpiredException(t)) {
58  performRedirect(externalContext, "/login");
59  } else {
60  log.error(t.getMessage(), t);
61  performRedirect(externalContext, "/error");
62  }
63  fc.renderResponse();
64  } finally {
65  i.remove();
66  }
67  }
68  getWrapped().handle();
69  }
boolean isSecurityException(Throwable t)
Definition: GlobalExceptionHandler.java:79
boolean isConversationException(Throwable t)
Definition: GlobalExceptionHandler.java:83
static final Logger log
Definition: GlobalExceptionHandler.java:26
boolean isViewExpiredException(Throwable t)
Definition: GlobalExceptionHandler.java:87
ExceptionHandler getWrapped()
Definition: GlobalExceptionHandler.java:35
void performRedirect(ExternalContext externalContext, String viewId)
Definition: GlobalExceptionHandler.java:91
void storeRequestURI()
Definition: GlobalExceptionHandler.java:71

◆ isConversationException()

boolean org.gluu.oxtrust.exception.GlobalExceptionHandler.isConversationException ( Throwable  t)
inlineprivate
83  {
84  return ExceptionUtils.getRootCause(t) instanceof NonexistentConversationException;
85  }

◆ isSecurityException()

boolean org.gluu.oxtrust.exception.GlobalExceptionHandler.isSecurityException ( Throwable  t)
inlineprivate
79  {
80  return ExceptionUtils.getRootCause(t) instanceof SecurityEvaluationException;
81  }

◆ isViewExpiredException()

boolean org.gluu.oxtrust.exception.GlobalExceptionHandler.isViewExpiredException ( Throwable  t)
inlineprivate
87  {
88  return t instanceof javax.faces.application.ViewExpiredException;
89  }

◆ performRedirect()

void org.gluu.oxtrust.exception.GlobalExceptionHandler.performRedirect ( ExternalContext  externalContext,
String  viewId 
)
inlineprivate
91  {
92  try {
93  externalContext.redirect(externalContext.getRequestContextPath() + viewId);
94  } catch (Exception e) {
95  log.error("Can't perform redirect to viewId: " + viewId, e);
96  }
97  }
static final Logger log
Definition: GlobalExceptionHandler.java:26

◆ storeRequestURI()

void org.gluu.oxtrust.exception.GlobalExceptionHandler.storeRequestURI ( )
inlineprotected
71  {
72  ExternalContext extContext = FacesContext.getCurrentInstance().getExternalContext();
73  String requestUri = ((javax.servlet.http.HttpServletRequest) extContext.getRequest()).getRequestURI();
74 
75  Identity identity = CdiUtil.bean(Identity.class);
76  identity.setSavedRequestUri(requestUri);
77  }

メンバ詳解

◆ log

final Logger org.gluu.oxtrust.exception.GlobalExceptionHandler.log = LoggerFactory.getLogger(GlobalExceptionHandler.class)
staticprivate

◆ wrapped

ExceptionHandler org.gluu.oxtrust.exception.GlobalExceptionHandler.wrapped
private

このクラス詳解は次のファイルから抽出されました: