org.apache.http.impl
public class: EnglishReasonPhraseCatalog [javadoc |
source]
java.lang.Object
org.apache.http.impl.EnglishReasonPhraseCatalog
All Implemented Interfaces:
ReasonPhraseCatalog
English reason phrases for HTTP status codes.
All status codes defined in RFC1945 (HTTP/1.0), RFC2616 (HTTP/1.1), and
RFC2518 (WebDAV) are supported.
- version:
$
- Revision: 744524 $
- since:
4.0
-
Field Summary |
---|
public static final EnglishReasonPhraseCatalog | INSTANCE | The default instance of this catalog.
This catalog is thread safe, so there typically
is no need to create other instances. |
Method from org.apache.http.impl.EnglishReasonPhraseCatalog Summary: |
---|
getReason |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from org.apache.http.impl.EnglishReasonPhraseCatalog Detail: |
public String getReason(int status,
Locale loc) {
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;
}
Obtains the reason phrase for a status code. |