public class MessageHeader extends Object
MessageHeader
interface.Modifier and Type | Field and Description |
---|---|
static String |
FN_CONNECTION
Field name for the connection header.
|
static String |
FN_CONTENT_LENGTH
Field name for the content-length header.
|
static String |
FN_CONTENT_TYPE
Field name for the content-type header.
|
static String |
FN_HOST
Field name for the host header.
|
static String |
FN_LOCATION
Field name for the location header.
|
static String |
FN_REFERER
Field name for the referer header.
|
static String |
FN_SERVER
Field name for the server header.
|
static String |
FN_TRANSFER_ENCODING
Field name for the user agent header.
|
static String |
FN_USER_AGENT
Field name for the user agent header.
|
static MessageHeader |
MH_CONNECTION_CLOSE
Use this
MessageHeader for indicating connection close. |
static MessageHeader |
MH_CONNECTION_KEEP_ALIVE
Use this
MessageHeader for indicating a keep-alive
connection. |
static MessageHeader |
MH_TRANSFER_ENCODING_CHUNKED
Use this
MessageHeader for sending chunked data. |
static MessageHeader |
MH_URL_ENCODED
Use this
MessageHeader for indicating a URL encoded
content type. |
static MessageHeader |
MH_USER_AGENT
Default user agent string for this library.
|
Constructor and Description |
---|
MessageHeader(String fieldName,
String fieldValue)
Initialize using a
field-name and field-value . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String |
getFieldContent()
Returns the value of this header.
|
String |
getFieldName()
Returns the name of the header, which for consistency is in
lower-case form.
|
int |
hashCode()
Returns the hashcode.
|
static MessageHeader |
makeHostHeader(URL url)
Returns a new
Host header, appropriate to the
given URL. |
static MessageHeader |
parse(String messageHeader)
Parse using a
message-header string. |
String |
toString()
Should return this
MessageHeader as: |
public static final String FN_HOST
public static final String FN_CONNECTION
public static final String FN_CONTENT_LENGTH
public static final String FN_CONTENT_TYPE
public static final String FN_LOCATION
public static final String FN_REFERER
public static final String FN_TRANSFER_ENCODING
public static final String FN_USER_AGENT
public static final String FN_SERVER
public static final MessageHeader MH_TRANSFER_ENCODING_CHUNKED
MessageHeader
for sending chunked data.public static final MessageHeader MH_CONNECTION_KEEP_ALIVE
MessageHeader
for indicating a keep-alive
connection.public static final MessageHeader MH_CONNECTION_CLOSE
MessageHeader
for indicating connection close.public static final MessageHeader MH_URL_ENCODED
MessageHeader
for indicating a URL encoded
content type.public static final MessageHeader MH_USER_AGENT
public static MessageHeader parse(String messageHeader) throws HttpException
message-header
string.HttpException
- if invalid HTTP message header data was used
in initializationpublic String getFieldName()
public String getFieldContent()
field-content
,
which excludes trailing and following white-space.public static MessageHeader makeHostHeader(URL url)
Host
header, appropriate to the
given URL.Copyright © 2012. All Rights Reserved.