Question: I'm wondering if there is an enum type in some standard Java class library that defines symbolic constants for all of the valid HTTP response codes. It should support conversion to/from the corresponding integer values.

I'm debugging some Java code that uses `javax.ws.rs.core.Response.Status`. It works, but it only defines about half of the valid HTTP response codes.

Answer: 
1) To get the reason **text** if you only have the code, you can use:

```
org.apache.http.impl.EnglishReasonPhraseCatalog.INSTANCE.getReason(httpCode,null)

```

Where `httpCode` would be the reason code that you got from the HTTP response.

See <https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/impl/EnglishReasonPhraseCatalog.html> for details

2) To get the reason **code** if you only have the text, you can use `BasicHttpResponse`.

See here for details: <https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/message/BasicHttpResponse.html>
Please see the following enum from the Spring framework which provides all the HTTP response status code

HttpStatus.values()