From d4b8f16d1f6e1cc42b43ab45138d50d93f466ff4 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Mon, 29 Jul 2013 18:38:53 -0700 Subject: [PATCH] Added http status codes from RFC 6585 --- .../codec/http/HttpResponseStatus.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java index 69a8ed3101..ca6d48c86e 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpResponseStatus.java @@ -232,6 +232,16 @@ public class HttpResponseStatus implements Comparable { */ 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) */ @@ -286,6 +296,12 @@ public class HttpResponseStatus implements Comparable { */ 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. * If the specified code is a standard HTTP getStatus code, a cached instance @@ -375,6 +391,12 @@ public class HttpResponseStatus implements Comparable { return UNORDERED_COLLECTION; case 426: return UPGRADE_REQUIRED; + case 428: + return PRECONDITION_REQUIRED; + case 429: + return TOO_MANY_REQUESTS; + case 431: + return REQUEST_HEADER_FIELDS_TOO_LARGE; case 500: return INTERNAL_SERVER_ERROR; case 501: @@ -393,6 +415,8 @@ public class HttpResponseStatus implements Comparable { return INSUFFICIENT_STORAGE; case 510: return NOT_EXTENDED; + case 511: + return NETWORK_AUTHENTICATION_REQUIRED; } final String reasonPhrase;