public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { chain.doFilter(request,response); } catch (ServletException e) { Throwable t = e.getRootCause(); if (t instanceof JellyTagException) { JellyTagException jte = (JellyTagException) t; Throwable cause = jte.getCause(); if (cause instanceof AcegiSecurityException) { AcegiSecurityException se = (AcegiSecurityException) cause; throw new ServletException(se); } } throw e; } }
public Throwable extractCause(Throwable throwable) { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); } });
public Throwable extractCause(Throwable throwable) { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); } });
if (ex.getRootCause() instanceof AuthenticationException || ex.getRootCause() instanceof AccessDeniedException) { handleException(request, response, chain, (AcegiSecurityException) ex.getRootCause());
protected void initExtractorMap() { super.initExtractorMap(); registerExtractor(ServletException.class, throwable -> { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); }); } }
if (e.getRootCause() instanceof AuthenticationException) { fail(request, response, (AuthenticationException) e.getRootCause());
try { chain.doFilter(request, response); } catch (ServletException e) { if (e.getRootCause() instanceof ViewExpiredException) { request.getRequestDispatcher("/expired").forward(request, response); } else { throw e; } }
public Throwable unwrapException(Throwable tomunch) { if (tomunch instanceof ServletException) { Throwable target = ((ServletException) tomunch).getRootCause(); if (target != null && target != tomunch) { return target; } } return null; }
try { chain.doFilter(request, response); } catch (ServletException e) { if (e.getRootCause() instanceof IllegalArgumentException) { response.sendError(HttpServletResponse.SC_BAD_REQUEST); } else { throw e; } }
private Throwable getRootCauseException(Object ex) { if (ex == null) return null; if (ex instanceof ServletException) { ex = ((ServletException)ex).getRootCause(); } if (ex instanceof Throwable) return ((Throwable)ex).getCause(); else return null; }
try { chain.doFilter(request, response); } catch (ServletException e) { if (e.getRootCause() instanceof ViewExpiredException) { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; res.sendRedirect(req.getContextPath() + "/errors/session-expired.jsf"); } else { throw e; } }
public Throwable extractCause(Throwable throwable) { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); } });
/** * Extract the root cause from a servlet exception. * * @param e The servlet exception */ public static Throwable getRootCause(ServletException e) { Throwable rootCause = e.getRootCause(); return findRootCause(e, rootCause); }
public Throwable extractCause(Throwable throwable) { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); } });
@Override public Throwable extractCause(final Throwable throwable) { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); } });
public Throwable extractCause(Throwable throwable) { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); } });
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { chain.doFilter(request, response); } catch (ServletException e) { Throwable t = e.getRootCause(); if (t instanceof JellyTagException) { JellyTagException jte = (JellyTagException) t; Throwable cause = jte.getCause(); } throw e; } }
private Map getRootCause(Object ex) { if (ex == null) return null; if (ex instanceof ServletException) { ex = ((ServletException)ex).getRootCause(); } if (ex instanceof Throwable) return getExceptionInfo((Throwable)ex); else return null; }
protected void initExtractorMap() { super.initExtractorMap(); registerExtractor(ServletException.class, throwable -> { ThrowableAnalyzer.verifyThrowableHierarchy(throwable, ServletException.class); return ((ServletException) throwable).getRootCause(); }); } }
@Test public void shouldThrowInstantiationExceptionCauseIfThereIsSuchException() { when(context.getInitParameter(BasicConfiguration.CONTAINER_PROVIDER)) .thenReturn(DogProvider.class.getName()); try { config.getProvider(); fail(); } catch (ServletException e) { assertNotNull("Should have a cause", e.getRootCause()); assertEquals(IOException.class, e.getRootCause().getClass()); } } }