Search in sources :

Example 1 with UnauthorizedActionException

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;
    }
}
Also used : RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) WicketRuntimeException(org.apache.wicket.WicketRuntimeException) Page(org.apache.wicket.Page) OSecurityException(com.orientechnologies.orient.core.exception.OSecurityException) OSchemaException(com.orientechnologies.orient.core.exception.OSchemaException) UnauthorizedActionException(org.apache.wicket.authorization.UnauthorizedActionException)

Aggregations

OSchemaException (com.orientechnologies.orient.core.exception.OSchemaException)1 OSecurityException (com.orientechnologies.orient.core.exception.OSecurityException)1 Page (org.apache.wicket.Page)1 WicketRuntimeException (org.apache.wicket.WicketRuntimeException)1 UnauthorizedActionException (org.apache.wicket.authorization.UnauthorizedActionException)1 PageProvider (org.apache.wicket.core.request.handler.PageProvider)1 RenderPageRequestHandler (org.apache.wicket.core.request.handler.RenderPageRequestHandler)1