Class Headers

java.lang.Object
com.renomad.minum.web.Headers

public final class Headers extends Object
Details extracted from the headers. For example, is this a keep-alive connection? what is the content-length, and so on. Here is some detail from Wikipedia on the subject:

HTTP header fields are a list of strings sent and received by both the client program and server on every HTTP request and response. These headers are usually invisible to the end-user and are only processed or logged by the server and client applications. They define how information sent/received through the connection are encoded (as in Content-Encoding), the session verification and identification of the client (as in browser cookies, IP address, user-agent) or their anonymity thereof (VPN or proxy masking, user-agent spoofing), how the server should handle data (as in Do-Not-Track), the age (the time it has resided in a shared cache) of the document being downloaded, amongst others.

  • Field Details

    • EMPTY

      public static final Headers EMPTY
  • Constructor Details

    • Headers

      public Headers(List<String> headerStrings)
  • Method Details

    • getHeaderStrings

      public List<String> getHeaderStrings()
    • contentType

      public String contentType()
      Gets the one content-type header, or returns an empty string
    • contentLength

      public int contentLength()
      Given the list of headers, find the one with the length of the body of the POST and return that value as an integer. If we do not find a content length, return -1.
    • hasKeepAlive

      public boolean hasKeepAlive()
      Indicates whether the headers in this request have a Connection: Keep-Alive
    • hasConnectionClose

      public boolean hasConnectionClose()
      Indicates whether the headers in this request have a Connection: close
    • valueByKey

      public List<String> valueByKey(String key)
      Allows a user to obtain any header value by its key, case-insensitively
      Returns:
      a List of string values, or null if no header was found.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object