use of org.apache.wicket.authorization.UnauthorizedActionException in project wicket-orientdb by OrienteerBAP.
the class OrientDefaultExceptionsHandlingListener method onException.
@Override
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
Throwable th = null;
if ((th = Exceptions.findCause(ex, OSecurityException.class)) != null || (th = Exceptions.findCause(ex, OValidationException.class)) != null || (th = Exceptions.findCause(ex, OSchemaException.class)) != null || (th = Exceptions.findCause(ex, IllegalStateException.class)) != null && Exceptions.findCause(ex, WicketRuntimeException.class) == null) {
Page page = extractCurrentPage(false);
if (page == null) {
return th instanceof OSecurityException ? new UnauthorizedInstantiationHandler(extractCurrentPage(true)) : null;
}
OrientDbWebSession.get().error(th.getMessage());
return new RenderPageRequestHandler(new PageProvider(page), RenderPageRequestHandler.RedirectPolicy.ALWAYS_REDIRECT);
} else if ((th = Exceptions.findCause(ex, UnauthorizedActionException.class)) != null) {
final UnauthorizedActionException unauthorizedActionException = (UnauthorizedActionException) th;
return new UnauthorizedInstantiationHandler(unauthorizedActionException.getComponent());
} else {
return null;
}
}
Aggregations