private void handleServletException( HttpServletRequest httpRequest, HttpServletResponse httpResponse, ServletException e) throws IOException, ServletException { EJBException ejbEx = ExceptionHandler.getEJBException(e); if (ejbEx != null && ejbEx.getCause() instanceof Exception && ejbEx.getCausedByException() instanceof AccessException) { String forwardErrorPage; if (BesServletRequestReader.isMarketplaceRequest(httpRequest)) { forwardErrorPage = Marketplace.MARKETPLACE_ROOT + Constants.INSUFFICIENT_AUTHORITIES_URI; } else { forwardErrorPage = Constants.INSUFFICIENT_AUTHORITIES_URI; } JSFUtils.sendRedirect(httpResponse, httpRequest.getContextPath() + forwardErrorPage); } else { // make sure we do not catch exceptions cause by // ViewExpiredException here, they'll be handled directly in the // doFilter() throw e; } }
private void handleError(RequestContext ctx, Exception e) throws IOException, ServletException { ctx.getRequest().setAttribute(ExceptionHandler.KEY_IN_REQUEST, e); if (exceptionHandler != null) { try { exceptionHandler.handleError(ctx, e); return; } catch (Exception ex) { e = ex; } } if (e instanceof RuntimeException) { throw (RuntimeException) e; } if (e instanceof IOException) { throw (IOException) e; } if (e instanceof ServletException) { throw (ServletException) e; } throw new ServletException(e); }