Beispiel #1
0
 /**
  * Gets the Enumerated value from the HTTP Status code
  *
  * @param code the HTTP Status code
  * @return The matching HttpStatus Enumerated value
  * @thows IllegalArgumentException if the HTTP Status is not a valid HTTP 1.1 status
  */
 public static HttpStatus fromStatus(final int code) {
   for (final HttpStatus httpStatus : HttpStatus.values()) {
     if (httpStatus.getStatus() == code) {
       return httpStatus;
     }
   }
   throw new IllegalArgumentException("HTTP Status code: " + code + " is not recognised.");
 }