List of usage examples for org.apache.wicket.markup.html.pages ExceptionErrorPage ExceptionErrorPage
public ExceptionErrorPage(final Throwable throwable, final Page page)
From source file:org.apache.syncope.client.console.SyncopeConsoleRequestCycleListener.java
License:Apache License
@Override public IRequestHandler onException(final RequestCycle cycle, final Exception e) { LOG.error("Exception found", e); PageParameters errorParameters = new PageParameters(); errorParameters.add("errorTitle", new StringResourceModel("alert").getString()); final Page errorPage; if (e instanceof UnauthorizedInstantiationException) { errorParameters.add("errorMessage", new StringResourceModel("unauthorizedInstantiationException").getString()); errorPage = new ErrorPage(errorParameters); } else if (e.getCause() instanceof AccessControlException) { errorParameters.add("errorMessage", new StringResourceModel("accessControlException").getString()); errorPage = new ErrorPage(errorParameters); } else if (e instanceof PageExpiredException || !(SyncopeConsoleSession.get()).isSignedIn()) { errorParameters.add("errorMessage", new StringResourceModel("pageExpiredException").getString()); errorPage = new ErrorPage(errorParameters); } else if (e.getCause() instanceof BadRequestException || e.getCause() instanceof WebServiceException || e.getCause() instanceof SyncopeClientException) { errorParameters.add("errorMessage", new StringResourceModel("restClientException").getString()); errorPage = new ErrorPage(errorParameters); } else {//from w w w . j av a 2s. com // redirect to default Wicket error page errorPage = new ExceptionErrorPage(e, null); } return new RenderPageRequestHandler(new PageProvider(errorPage)); }
From source file:org.apache.syncope.client.console.SyncopeRequestCycleListener.java
License:Apache License
/** * {@inheritDoc}/*from ww w.j a v a2 s . co m*/ */ @Override public IRequestHandler onException(final RequestCycle cycle, final Exception e) { LOG.error("Exception found", e); PageParameters errorParameters = new PageParameters(); errorParameters.add("errorTitle", new StringResourceModel("alert", null).getString()); final Page errorPage; if (e instanceof UnauthorizedInstantiationException) { errorParameters.add("errorMessage", new StringResourceModel("unauthorizedInstantiationException", null).getString()); errorPage = new ErrorPage(errorParameters); } else if (e.getCause() instanceof AccessControlException) { errorParameters.add("errorMessage", new StringResourceModel("accessControlException", null).getString()); errorPage = new ErrorPage(errorParameters); } else if (e instanceof PageExpiredException || !(SyncopeSession.get()).isAuthenticated()) { errorParameters.add("errorMessage", new StringResourceModel("pageExpiredException", null).getString()); errorPage = new ErrorPage(errorParameters); } else if (e.getCause() instanceof BadRequestException || e.getCause() instanceof WebServiceException || e.getCause() instanceof SyncopeClientException) { errorParameters.add("errorMessage", new StringResourceModel("restClientException", null).getString()); errorPage = new ErrorPage(errorParameters); } else { // redirect to default Wicket error page errorPage = new ExceptionErrorPage(e, null); } return new RenderPageRequestHandler(new PageProvider(errorPage)); }
From source file:org.syncope.console.SyncopeRequestCycleListener.java
License:Apache License
/** * {@inheritDoc}//from ww w . j a v a 2s. c o m */ @Override public IRequestHandler onException(final RequestCycle cycle, final Exception e) { LOG.error("Exception found", e); final Page errorPage; PageParameters errorParameters = new PageParameters(); errorParameters.add("errorTitle", new StringResourceModel("alert", null).getString()); if (e instanceof UnauthorizedInstantiationException) { errorParameters.add("errorMessage", new StringResourceModel("unauthorizedInstantiationException", null).getString()); errorPage = new ErrorPage(errorParameters); } else if (e instanceof HttpClientErrorException) { errorParameters.add("errorMessage", new StringResourceModel("httpClientException", null).getString()); errorPage = new ErrorPage(errorParameters); } else if (e instanceof PageExpiredException || !(SyncopeSession.get()).isAuthenticated()) { errorParameters.add("errorMessage", new StringResourceModel("pageExpiredException", null).getString()); errorPage = new ErrorPage(errorParameters); } else if (e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof RestClientException) { errorParameters.add("errorMessage", new StringResourceModel("restClientException", null).getString()); errorPage = new ErrorPage(errorParameters); } else { // redirect to default Wicket error page errorPage = new ExceptionErrorPage(e, null); } return new ComponentRenderingRequestHandler(errorPage); }