Package rife.tools
Class HttpUtils
java.lang.Object
rife.tools.HttpUtils
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
basicAuthorizationHeader
(String username, String password) Generates the header value for basic HTTP authorization.static String
extractMimeTypeFromContentType
(String contentType) Extracts only the mime-type from a Content-Type HTTP header.static String
statusReason
(int statusCode) Returns a textual reason for an HTTP status code.
-
Field Details
-
HEADER_AUTHORIZATION
- See Also:
-
HEADER_USER_AGENT
- See Also:
-
CHARSET
- See Also:
-
HTTP_STATUS_REASONS
-
-
Method Details
-
statusReason
Returns a textual reason for an HTTP status code.- Parameters:
statusCode
- the status code to get the reason for- Returns:
- the textual reason for the provided HTTP status code
- Since:
- 1.5.7
-
extractMimeTypeFromContentType
Extracts only the mime-type from a Content-Type HTTP header. Thus a header like this:text/html;charset=UTF-8
will return:text/html
- Parameters:
contentType
- the Content-Type header- Returns:
- the content type header without the charset
- Since:
- 1.0
-
basicAuthorizationHeader
Generates the header value for basic HTTP authorization.- Parameters:
username
- the authenticated usernamepassword
- the authenticated password- Returns:
- the header value for basic HTTP authorization
- Since:
- 1.5.7
-