/** * Return the enum constant of this type with the corresponding series. * @param statusCode the HTTP status code (potentially non-standard) * @return the enum constant of this type with the corresponding series * @throws IllegalArgumentException if this enum has no corresponding constant */ public static Series valueOf(int statusCode) { Series series = resolve(statusCode); if (series == null) { throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); } return series; }
/** * Return the enum constant of this type with the corresponding series. * @param statusCode the HTTP status code (potentially non-standard) * @return the enum constant of this type with the corresponding series * @throws IllegalArgumentException if this enum has no corresponding constant */ public static Series valueOf(int statusCode) { Series series = resolve(statusCode); if (series == null) { throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); } return series; }
/** * Return the enum constant of this type with the corresponding series. * @param statusCode the HTTP status code (potentially non-standard) * @return the enum constant of this type with the corresponding series * @throws IllegalArgumentException if this enum has no corresponding constant */ public static Series valueOf(int statusCode) { Series series = resolve(statusCode); if (series == null) { throw new IllegalArgumentException("No matching constant for [" + statusCode + "]"); } return series; }
/** * Template method called from {@link #hasError(ClientHttpResponse)}. * <p>The default implementation checks if the given status code is * {@code HttpStatus.Series#CLIENT_ERROR CLIENT_ERROR} or * {@code HttpStatus.Series#SERVER_ERROR SERVER_ERROR}. * Can be overridden in subclasses. * @param unknownStatusCode the HTTP status code as raw value * @return {@code true} if the response indicates an error; {@code false} otherwise * @since 4.3.21 * @see HttpStatus.Series#CLIENT_ERROR * @see HttpStatus.Series#SERVER_ERROR */ protected boolean hasError(int unknownStatusCode) { HttpStatus.Series series = HttpStatus.Series.resolve(unknownStatusCode); return (series == HttpStatus.Series.CLIENT_ERROR || series == HttpStatus.Series.SERVER_ERROR); }
/** * Template method called from {@link #hasError(ClientHttpResponse)}. * <p>The default implementation checks if the given status code is * {@code HttpStatus.Series#CLIENT_ERROR CLIENT_ERROR} or * {@code HttpStatus.Series#SERVER_ERROR SERVER_ERROR}. * Can be overridden in subclasses. * @param unknownStatusCode the HTTP status code as raw value * @return {@code true} if the response indicates an error; {@code false} otherwise * @since 4.3.21 * @see HttpStatus.Series#CLIENT_ERROR * @see HttpStatus.Series#SERVER_ERROR */ protected boolean hasError(int unknownStatusCode) { HttpStatus.Series series = HttpStatus.Series.resolve(unknownStatusCode); return (series == HttpStatus.Series.CLIENT_ERROR || series == HttpStatus.Series.SERVER_ERROR); }
/** * Template method called from {@link #hasError(ClientHttpResponse)}. * <p>The default implementation checks if the given status code is * {@code HttpStatus.Series#CLIENT_ERROR CLIENT_ERROR} or * {@code HttpStatus.Series#SERVER_ERROR SERVER_ERROR}. * Can be overridden in subclasses. * @param unknownStatusCode the HTTP status code as raw value * @return {@code true} if the response indicates an error; {@code false} otherwise * @since 4.3.21 * @see HttpStatus.Series#CLIENT_ERROR * @see HttpStatus.Series#SERVER_ERROR */ protected boolean hasError(int unknownStatusCode) { HttpStatus.Series series = HttpStatus.Series.resolve(unknownStatusCode); return (series == HttpStatus.Series.CLIENT_ERROR || series == HttpStatus.Series.SERVER_ERROR); }