EnglishReasonPhraseCatalogpublic class EnglishReasonPhraseCatalog extends Object implements ReasonPhraseCatalogEnglish reason phrases for HTTP status codes.
All status codes defined in RFC1945 (HTTP/1.0), RFC2616 (HTTP/1.1), and
RFC2518 (WebDAV) are supported. |
Fields Summary |
---|
public static final EnglishReasonPhraseCatalog | INSTANCEThe default instance of this catalog.
This catalog is thread safe, so there typically
is no need to create other instances. | private static final String[] | REASON_PHRASESReason phrases lookup table. |
Constructors Summary |
---|
protected EnglishReasonPhraseCatalog()Restricted default constructor, for derived classes.
If you need an instance of this class, use {@link #INSTANCE INSTANCE}.
// no body
|
Methods Summary |
---|
public java.lang.String | getReason(int status, java.util.Locale loc)Obtains the reason phrase for a status code.
if ((status < 100) || (status >= 600)) {
throw new IllegalArgumentException
("Unknown category for status code " + status + ".");
}
final int category = status / 100;
final int subcode = status - 100*category;
String reason = null;
if (REASON_PHRASES[category].length > subcode)
reason = REASON_PHRASES[category][subcode];
return reason;
| private static void | setReason(int status, java.lang.String reason)Stores the given reason phrase, by status code.
Helper method to initialize the static lookup table.
final int category = status / 100;
final int subcode = status - 100*category;
REASON_PHRASES[category][subcode] = reason;
|
|