List of usage examples for org.springframework.web.servlet DispatcherServlet EXCEPTION_ATTRIBUTE
String EXCEPTION_ATTRIBUTE
To view the source code for org.springframework.web.servlet DispatcherServlet EXCEPTION_ATTRIBUTE.
Click Source Link
From source file:org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.java
private void filterAndRecordMetrics(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain, Object handler) throws IOException, ServletException { TimingContext timingContext = TimingContext.get(request); if (timingContext == null) { timingContext = startAndAttachTimingContext(request, handler); }//from w w w .j ava2 s . c om try { filterChain.doFilter(request, response); if (!request.isAsyncStarted()) { // Only record when async processing has finished or never been started. // If async was started by something further down the chain we wait // until the second filter invocation (but we'll be using the // TimingContext that was attached to the first) Throwable exception = (Throwable) request.getAttribute(DispatcherServlet.EXCEPTION_ATTRIBUTE); record(timingContext, response, request, handler, exception); } } catch (NestedServletException ex) { response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); record(timingContext, response, request, handler, ex.getCause()); throw ex; } }