Java Code Examples for org.springframework.web.servlet.HandlerExceptionResolver#resolveException()
The following examples show how to use
org.springframework.web.servlet.HandlerExceptionResolver#resolveException() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HandlerExceptionResolverComposite.java From spring-analysis-note with MIT License | 6 votes |
/** * Resolve the exception by iterating over the list of configured exception resolvers. * <p>The first one to return a {@link ModelAndView} wins. Otherwise {@code null} is returned. */ @Override @Nullable public ModelAndView resolveException( HttpServletRequest request, HttpServletResponse response, @Nullable Object handler, Exception ex) { if (this.resolvers != null) { for (HandlerExceptionResolver handlerExceptionResolver : this.resolvers) { ModelAndView mav = handlerExceptionResolver.resolveException(request, response, handler, ex); if (mav != null) { return mav; } } } return null; }
Example 2
Source File: HandlerExceptionResolverComposite.java From java-technology-stack with MIT License | 6 votes |
/** * Resolve the exception by iterating over the list of configured exception resolvers. * <p>The first one to return a {@link ModelAndView} wins. Otherwise {@code null} * is returned. */ @Override @Nullable public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, @Nullable Object handler,Exception ex) { if (this.resolvers != null) { for (HandlerExceptionResolver handlerExceptionResolver : this.resolvers) { ModelAndView mav = handlerExceptionResolver.resolveException(request, response, handler, ex); if (mav != null) { return mav; } } } return null; }
Example 3
Source File: HandlerExceptionResolverComposite.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Resolve the exception by iterating over the list of configured exception resolvers. * The first one to return a ModelAndView instance wins. Otherwise {@code null} is returned. */ @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { if (resolvers != null) { for (HandlerExceptionResolver handlerExceptionResolver : resolvers) { ModelAndView mav = handlerExceptionResolver.resolveException(request, response, handler, ex); if (mav != null) { return mav; } } } return null; }
Example 4
Source File: RollbarHandlerExceptionResolverTest.java From rollbar-java with MIT License | 6 votes |
@Test public void testRollbarExceptionResolver() { Exception testException = new Exception("test exception"); // build the Rollbar mock object Rollbar rollbar = mock(Rollbar.class); doNothing().when(rollbar).error(testException); // construct exception resolver from the Rollbar resolver for Spring webmvc HandlerExceptionResolver handlerExceptionResolver = new RollbarHandlerExceptionResolver(rollbar); // build a full mocked out request for the exception resolver handlerExceptionResolver.resolveException(request, response, null, testException); // verify that the rollbar mocked object got the exception inside the resolver verify(rollbar, times(1)).error(testException); }
Example 5
Source File: HandlerExceptionResolverComposite.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Resolve the exception by iterating over the list of configured exception resolvers. * The first one to return a ModelAndView instance wins. Otherwise {@code null} is returned. */ @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler,Exception ex) { if (this.resolvers != null) { for (HandlerExceptionResolver handlerExceptionResolver : this.resolvers) { ModelAndView mav = handlerExceptionResolver.resolveException(request, response, handler, ex); if (mav != null) { return mav; } } } return null; }