Spring Framework DefaultHandlerExceptionResolver - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework DefaultHandlerExceptionResolver class.

This code example shows how to use the following methods:
	private WebResponseExceptionTranslator exceptionTranslator = new DefaultWebResponseExceptionTranslator(); 
 
	private OAuth2ExceptionRenderer exceptionRenderer = new DefaultOAuth2ExceptionRenderer(); 
 
	// This is from Spring MVC. 
	private HandlerExceptionResolver handlerExceptionResolver = new DefaultHandlerExceptionResolver(); 
 
	public void setExceptionTranslator(WebResponseExceptionTranslator exceptionTranslator) { 
		this.exceptionTranslator = exceptionTranslator; 
	} 
 
	public void setExceptionRenderer(OAuth2ExceptionRenderer exceptionRenderer) { 
		this.exceptionRenderer = exceptionRenderer; 
	} 
 
	protected final void doHandle(HttpServletRequest request, HttpServletResponse response, Exception authException) 
			throws IOException, ServletException { 
		try { 
			ResponseEntity<OAuth2Exception> result = exceptionTranslator.translate(authException); 
			result = enhanceResponse(result, authException); 
5
CodeRank
This code example shows how to use the following methods:
 
	private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionResolver.class); 
	 
	private final ResponseStatusExceptionResolver annotatedExceptionHandler = new ResponseStatusExceptionResolver(); 
	 
	private final DefaultHandlerExceptionResolver defaultExceptionHandler = new DefaultHandlerExceptionResolver(); 
		 
	public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { 
		try { 
			if (ex instanceof EmptyResultDataAccessException) { 
				return handleEmptyResultDataAccessException((EmptyResultDataAccessException) ex, request, response, handler); 
			} 
		} catch (Exception e) { 
			logger.warn("Handling of [" + ex.getClass().getName() + "] resulted in Exception", ex); 
			return null; 
		} 
		ModelAndView result = annotatedExceptionHandler.resolveException(request, response, handler, ex); 
		if (result != null) { 
			return result; 
		} 
5
CodeRank
This code example shows how to use the following methods:
 
/** 
 * 
 * @author jkowalczyk 
 */ 
public class TgolHandlerExceptionResolver extends DefaultHandlerExceptionResolver { 
 
   /** 
     * This exception resolver displays the audit set page for file upload 
     * when the MaxUploadSizeExceededException is thrown 
     * 
     * @param hsr 
     * @param hsr1 
     * @param o 
     * @param excptn 
     * @return 
     */ 
    @Override 
    @SuppressWarnings("unchecked") 
    public ModelAndView doResolveException(HttpServletRequest hsr, HttpServletResponse hsr1, Object o, Exception excptn) { 
4
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:doResolveException
    protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, 
            Exception ex) { 
        // call super method with wrapped response to return a reponse body with 
        // a single line 
        HttpServletResponse wrappedResponse = new ApiResponseWrapper(response); 
        ModelAndView mav = super.doResolveException(request, wrappedResponse, handler, ex); 
 
        if (mav != null) // super method handled the exception 
            return mav; 
 
        try { 
            handleExceptions(ex, wrappedResponse); 
        } catch (IOException e) { 
            logger.debug(e); 
        } 
         
        return new ModelAndView(); 
    } 
 
    private void handleExceptions(Throwable ex, HttpServletResponse response) throws IOException { 
4
CodeRank