Package net.thauvin.erik.httpstatus
Class Reasons
java.lang.Object
net.thauvin.erik.httpstatus.Reasons
Loads HTTP status reason phrases from the resource bundle and provides
lookup utilities for individual status codes and status code classes.
The reason phrases are stored in a sorted, immutable map for predictable iteration order and thread‑safe access.
-
Method Summary
Modifier and TypeMethodDescriptiongetReasonClass(StatusCodeClass reasonClass) Returns all reason phrases belonging to the given status code class.static StringgetReasonPhrase(Object statusCode) Returns the reason phrase for the given status code, or null if none exists.static StringgetReasonPhrase(Object statusCode, String defaultReason) Returns the reason phrase for the given status code, or the provided default value if no phrase is defined.static voidPrints reason phrases for the given status code(s) or status code class(es).
-
Method Details
-
getReasonClass
Returns all reason phrases belonging to the given status code class.The returned map is sorted by status code.
-
getReasonPhrase
Returns the reason phrase for the given status code, or null if none exists.Accepts either an integer or string representation of the status code.
-
getReasonPhrase
Returns the reason phrase for the given status code, or the provided default value if no phrase is defined. -
main
Prints reason phrases for the given status code(s) or status code class(es).If no arguments are provided, prints all reason phrases.
-