private boolean httpStatusSuccessful(HttpServletResponse response) { if (response.getStatus() == 0) { return false; } HttpStatus.Series httpStatusSeries = HttpStatus.Series .valueOf(response.getStatus()); return httpStatusSeries == HttpStatus.Series.SUCCESSFUL || httpStatusSeries == HttpStatus.Series.REDIRECTION; }
private boolean httpStatusSuccessful(HttpServletResponse response) { if (response.getStatus() == 0) { return false; } HttpStatus.Series httpStatusSeries = HttpStatus.Series .valueOf(response.getStatus()); return httpStatusSeries == HttpStatus.Series.SUCCESSFUL || httpStatusSeries == HttpStatus.Series.REDIRECTION; }
@Override public void handleError(ClientHttpResponse response, HttpStatus statusCode) throws IOException { if (statusCode.series() == HttpStatus.Series.CLIENT_ERROR) { throw new HttpClientErrorException(statusCode, response.getStatusText(), response.getHeaders(), getResponseBody(response), getCharset(response)); } else if (statusCode.series() == HttpStatus.Series.SERVER_ERROR) { throw new HttpServerErrorException(statusCode, response.getStatusText(), response.getHeaders(), getResponseBody(response), getCharset(response)); } else { try { HttpStatus.Series.valueOf(statusCode); super.handleError(response, statusCode); } catch (Exception e) { throw new UnknownHttpStatusCodeException(statusCode.value(), response.getStatusText(), response.getHeaders(), getResponseBody(response), getCharset(response)); } } }
/** * Return the enum constant of this type with the corresponding series. * @param status a standard HTTP status enum value * @return the enum constant of this type with the corresponding series * @throws IllegalArgumentException if this enum has no corresponding constant */ public static Series valueOf(HttpStatus status) { return valueOf(status.value); }
static boolean isSuccessful(int code) { try { return HttpStatus.Series.SUCCESSFUL.equals(HttpStatus.Series.valueOf(code)); } catch (Exception ignored) { return false; } }
/** * Return the enum constant of this type with the corresponding series. * @param status a standard HTTP status enum value * @return the enum constant of this type with the corresponding series * @throws IllegalArgumentException if this enum has no corresponding constant */ public static Series valueOf(HttpStatus status) { return valueOf(status.value); }
/** * Return the HTTP status series of this status code. * @see HttpStatus.Series */ public Series series() { return Series.valueOf(this); }
/** * Return the HTTP status series of this status code. * @see HttpStatus.Series */ public Series series() { return Series.valueOf(this); }
public HttpStatus.Series getSeries() { if (httpStatus != null) { return httpStatus.series(); } if (status != null) { return HttpStatus.Series.valueOf(status); } return null; }
/** * Return the enum constant of this type with the corresponding series. * @param status a standard HTTP status enum value * @return the enum constant of this type with the corresponding series * @throws IllegalArgumentException if this enum has no corresponding constant */ public static Series valueOf(HttpStatus status) { return valueOf(status.value); }
/** * Return the HTTP status series of this status code. * @see HttpStatus.Series */ public Series series() { return Series.valueOf(this); }
/** * Return the enum constant of this type with the corresponding series. * @param status a standard HTTP status enum value * @return the enum constant of this type with the corresponding series * @throws IllegalArgumentException if this enum has no corresponding constant */ public static Series valueOf(HttpStatus status) { return valueOf(status.value); }
/** * Return the HTTP status series of this status code. * @see HttpStatus.Series */ public Series series() { return Series.valueOf(this); }