Package rife.tools

Class HttpUtils

java.lang.Object
rife.tools.HttpUtils

public final class HttpUtils extends Object
  • Field Details

  • Method Details

    • statusReason

      public static String statusReason(int statusCode)
      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

      public static String extractMimeTypeFromContentType(String contentType)
      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

      public static String basicAuthorizationHeader(String username, String password)
      Generates the header value for basic HTTP authorization.
      Parameters:
      username - the authenticated username
      password - the authenticated password
      Returns:
      the header value for basic HTTP authorization
      Since:
      1.5.7