Class HttpHeader

java.lang.Object
org.htmlparser.http.HttpHeader

public class HttpHeader extends Object
Utility methods to display HTTP headers.
  • Method Details

    • getRequestHeader

      public static String getRequestHeader(HttpURLConnection connection)
      Gets the request header for the connection. This header is generated from the contents of the connection and may not be exactly the same as the request that will be sent.
      Parameters:
      connection - The connection to convert into an HTTP request header.
      Returns:
      The string that would be sent by the HTTP request.
    • getResponseHeader

      public static String getResponseHeader(HttpURLConnection conn)
      Gets the response header for the connection. Calling this method on an un-connected connection will generate an error, as will an attempt to get information from a connected but invalid connection. This header is generated from the contents of the connection and may not be exactly the same as the response that was received.
      Parameters:
      conn - The connection to convert into an HTTP response header.
      Returns:
      The string that was sent as the HTTP response.