You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2019/09/04 17:11:02 UTC

[GitHub] [httpcomponents-core] garydgregory commented on a change in pull request #145: Added family property

garydgregory commented on a change in pull request #145: Added family property
URL: https://github.com/apache/httpcomponents-core/pull/145#discussion_r320874379
 
 

 ##########
 File path: httpcore5/src/main/java/org/apache/hc/core5/http/message/StatusLine.java
 ##########
 @@ -89,6 +99,65 @@ public ProtocolVersion getProtocolVersion() {
     public String getReasonPhrase() {
         return this.reasonPhrase;
     }
+    
+    /**
+     * An enumeration representing the class of status code. Family is used
+     * here since class is overloaded in Java.
+     */
+    public enum Family {
+        /**
+         * {@code 1xx} HTTP status codes.
+         */
+        INFORMATIONAL,
+    
+        /**
+         * {@code 2xx} HTTP status codes.
+         */
+        SUCCESSFUL,
+        
+        /**
+         * {@code 3xx} HTTP status codes.
+         */
+        REDIRECTION,
+        
+        /**
+         * {@code 4xx} HTTP status codes.
+         */
+        CLIENT_ERROR,
+        
+        /**
+         * {@code 5xx} HTTP status codes.
+         */
+        SERVER_ERROR,
+        
+        /**
+         * Other, unrecognized HTTP status codes.
+         */
+        OTHER;
+
+        /**
+         * Get the response status family for the status code.
+         *
+         * @param statusCode response status code to get the family for.
+         * @return family of the response status code.
+         */
+        public static Family familyOf(final int statusCode) {
 
 Review comment:
   Yes "class" is the proper name but I think we should call this enum `StatusClass` and put it in its own file.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org