Package org.htmlparser.http
Class HttpHeader
- java.lang.Object
-
- org.htmlparser.http.HttpHeader
-
public class HttpHeader extends java.lang.Object
Utility methods to display HTTP headers.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getRequestHeader(java.net.HttpURLConnection connection)
Gets the request header for the connection.static java.lang.String
getResponseHeader(java.net.HttpURLConnection conn)
Gets the response header for the connection.
-
-
-
Method Detail
-
getRequestHeader
public static java.lang.String getRequestHeader(java.net.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 java.lang.String getResponseHeader(java.net.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.
-
-