Added http status codes from RFC 6585

This commit is contained in:
Josh Wilson 2013-07-29 18:38:53 -07:00 committed by Norman Maurer
parent 56646920c0
commit d4b8f16d1f

View File

@ -232,6 +232,16 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
*/ */
public static final HttpResponseStatus UPGRADE_REQUIRED = new HttpResponseStatus(426, "Upgrade Required"); public static final HttpResponseStatus UPGRADE_REQUIRED = new HttpResponseStatus(426, "Upgrade Required");
/**
* 428 Precondition Required (RFC6585)
*/
public static final HttpResponseStatus PRECONDITION_REQUIRED = new HttpResponseStatus(428, "Precondition Required");
/**
* 429 Too Many Requests (RFC6585)
*/
public static final HttpResponseStatus TOO_MANY_REQUESTS = new HttpResponseStatus(429, "Too Many Requests");
/** /**
* 431 Request Header Fields Too Large (RFC6585) * 431 Request Header Fields Too Large (RFC6585)
*/ */
@ -286,6 +296,12 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
*/ */
public static final HttpResponseStatus NOT_EXTENDED = new HttpResponseStatus(510, "Not Extended"); public static final HttpResponseStatus NOT_EXTENDED = new HttpResponseStatus(510, "Not Extended");
/**
* 511 Network Authentication Required (RFC6585)
*/
public static final HttpResponseStatus NETWORK_AUTHENTICATION_REQUIRED =
new HttpResponseStatus(511, "Network Authentication Required");
/** /**
* Returns the {@link HttpResponseStatus} represented by the specified code. * Returns the {@link HttpResponseStatus} represented by the specified code.
* If the specified code is a standard HTTP getStatus code, a cached instance * If the specified code is a standard HTTP getStatus code, a cached instance
@ -375,6 +391,12 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
return UNORDERED_COLLECTION; return UNORDERED_COLLECTION;
case 426: case 426:
return UPGRADE_REQUIRED; return UPGRADE_REQUIRED;
case 428:
return PRECONDITION_REQUIRED;
case 429:
return TOO_MANY_REQUESTS;
case 431:
return REQUEST_HEADER_FIELDS_TOO_LARGE;
case 500: case 500:
return INTERNAL_SERVER_ERROR; return INTERNAL_SERVER_ERROR;
case 501: case 501:
@ -393,6 +415,8 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
return INSUFFICIENT_STORAGE; return INSUFFICIENT_STORAGE;
case 510: case 510:
return NOT_EXTENDED; return NOT_EXTENDED;
case 511:
return NETWORK_AUTHENTICATION_REQUIRED;
} }
final String reasonPhrase; final String reasonPhrase;