org.springframework.web.bind.annotation.ExceptionHandler.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(218)

本文整理了Java中org.springframework.web.bind.annotation.ExceptionHandler.<init>()方法的一些代码示例,展示了ExceptionHandler.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExceptionHandler.<init>()方法的具体详情如下:
包路径:org.springframework.web.bind.annotation.ExceptionHandler
类名称:ExceptionHandler
方法名:<init>

ExceptionHandler.<init>介绍

暂无

代码示例

代码示例来源:origin: sqshq/piggymetrics

@ExceptionHandler(IllegalArgumentException.class)
  @ResponseStatus(HttpStatus.BAD_REQUEST)
  public void processValidationError(IllegalArgumentException e) {
    log.info("Returning HTTP 400 Bad Request", e);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@ExceptionHandler(Exception.class)
  @ResponseBody
  String handleException(Exception exception);
}

代码示例来源:origin: apache/kylin

@ResponseStatus(HttpStatus.FORBIDDEN)
@ExceptionHandler(ForbiddenException.class)
@ResponseBody
ErrorResponse handleForbidden(HttpServletRequest req, Exception ex) {
  return new ErrorResponse(req.getRequestURL().toString(), ex);
}

代码示例来源:origin: spring-projects/spring-framework

@ExceptionHandler(Exception.class)
  @ResponseBody
  String handleException(Exception exception);
}

代码示例来源:origin: prontera/spring-cloud-rest-tcc

@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler({ReservationExpireException.class, ReservationAlmostToExpireException.class})
public void expireReservationException(Exception e, HttpServletRequest request) {
}

代码示例来源:origin: apache/kylin

@ResponseStatus(HttpStatus.BAD_REQUEST)
@ExceptionHandler(BadRequestException.class)
@ResponseBody
ErrorResponse handleBadRequest(HttpServletRequest req, Exception ex) {
  logger.error("", ex);
  return new ErrorResponse(req.getRequestURL().toString(), ex);
}

代码示例来源:origin: spring-projects/spring-framework

@ExceptionHandler
  @ResponseBody
  String handleException(IllegalArgumentException ex);
}

代码示例来源:origin: prontera/spring-cloud-rest-tcc

@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ReservationExpireException.class)
public void expireReservation(ReservationExpireException e, HttpServletRequest request) {
}

代码示例来源:origin: apache/kylin

@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NotFoundException.class)
@ResponseBody
ErrorResponse handleNotFound(HttpServletRequest req, Exception ex) {
  return new ErrorResponse(req.getRequestURL().toString(), ex);
}

代码示例来源:origin: spring-projects/spring-framework

@ExceptionHandler(Exception.class)
  @ResponseBody
  public abstract String handleException(Exception exception);
}

代码示例来源:origin: prontera/spring-cloud-rest-tcc

@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ReservationExpireException.class)
public void expireReservation(ReservationExpireException e, HttpServletRequest request) {
}

代码示例来源:origin: apache/kylin

@ResponseStatus(HttpStatus.TOO_MANY_REQUESTS)
@ExceptionHandler(TooManyRequestException.class)
@ResponseBody
ErrorResponse handleTooManyRequest(HttpServletRequest req, Exception ex) {
  return new ErrorResponse(req.getRequestURL().toString(), ex);
}

代码示例来源:origin: spring-projects/spring-framework

@ExceptionHandler(Exception.class)
  @ResponseBody
  public abstract String handleException(Exception exception);
}

代码示例来源:origin: spring-cloud/spring-cloud-config

@ExceptionHandler(NoSuchResourceException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
public void notFound(NoSuchResourceException e) {
}

代码示例来源:origin: apache/kylin

@ResponseStatus(HttpStatus.UNAUTHORIZED)
@ExceptionHandler(UnauthorizedException.class)
@ResponseBody
ErrorResponse handleUnauthorized(HttpServletRequest req, Exception ex) {
  return new ErrorResponse(req.getRequestURL().toString(), ex);
}

代码示例来源:origin: spring-projects/spring-framework

@ExceptionHandler(Exception.class)
  @ResponseBody
  public abstract String handleException(Exception exception);
}

代码示例来源:origin: cloudfoundry/uaa

@ExceptionHandler(UnsupportedOperationException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
public void handleException() {
}

代码示例来源:origin: wuyouzhuguli/SpringAll

@ExceptionHandler(UserNotExistException.class)
  @ResponseBody
  @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
  public Map<String, Object> handleUserNotExistsException(UserNotExistException e) {
    Map<String, Object> map = new HashMap<>();
    map.put("id", e.getId());
    map.put("message", e.getMessage());
    return map;
  }
}

代码示例来源:origin: spring-projects/spring-framework

@ExceptionHandler(Exception.class)
  @ResponseBody
  public abstract String handleException(Exception exception);
}

代码示例来源:origin: stylefeng/Guns

/**
 * 用户未登录异常
 */
@ExceptionHandler(AuthenticationException.class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
public String unAuth(AuthenticationException e) {
  log.error("用户未登陆:", e);
  return "/login.html";
}

相关文章