Fields Summary |
---|
public static final String | ERROR_INFOConstant ERROR_INFO field. |
public static final String | MIME_VERSIONConstant MIME_VERSION field. |
public static final String | IN_REPLY_TOConstant IN_REPLY_TO field. |
public static final String | ALLOWConstant ALLOW field. |
public static final String | ALLOW_EVENTSConstant ALLOW_EVENTS field. |
public static final String | CONTENT_LANGUAGEConstant CONTENT_LANGUAGE field. |
public static final String | CALL_INFOConstant CALL_INFO field. |
public static final String | CSEQConstant CSEQ field. |
public static final String | ALERT_INFOConstant ALERT_INFO field. |
public static final String | ACCEPT_ENCODINGConstant ACCEPT_ENCODING field. |
public static final String | ACCEPTConstant ACCEPT field. |
public static final String | ENCRYPTIONConstant ENCRYPTION field. |
public static final String | ACCEPT_LANGUAGEConstant ACCEPT_LANGUAGE field. |
public static final String | ACCEPT_CONTACTConstant ACCEPT_CONTACT field. |
public static final String | RECORD_ROUTEConstant RECORD_ROUTE field. |
public static final String | TIMESTAMPConstant TIMESTAMP field. |
public static final String | TOConstant TO field. |
public static final String | VIAConstant VIA field. |
public static final String | FROMConstant FROM field. |
public static final String | CALL_IDConstant CALL_ID field. |
public static final String | AUTHENTICATION_INFOConstant AUTHENTICATION_INFO field. |
public static final String | AUTHORIZATIONConstant AUTHORIZATION field. |
public static final String | PROXY_AUTHENTICATEConstant PROXY_AUTHENTICATE field. |
public static final String | SERVERConstant SERVER field. |
public static final String | UNSUPPORTEDConstant UNSUPPORTED field. |
public static final String | RETRY_AFTERConstant RETRY_AFTER field. |
public static final String | CONTENT_TYPEConstant CONTENT_TYP field. |
public static final String | CONTENT_ENCODINGConstant CONTENT_ENCODING field. |
public static final String | CONTENT_LENGTHConstant CONTENT_LENGTH field. |
public static final String | HIDEConstant HIDE field. |
public static final String | ROUTEConstant ROUTE field. |
public static final String | CONTACTConstant CONTACT field. |
public static final String | WWW_AUTHENTICATEConstant WWW_AUTHENTICATE field. |
public static final String | MAX_FORWARDSConstant MAX_FORWARDS field. |
public static final String | ORGANIZATIONConstant ORGANIZATION field. |
public static final String | PROXY_AUTHORIZATIONConstant PROXY_AUTHORIZATION field. |
public static final String | PROXY_REQUIREConstant PROXY_REQUIRE field. |
public static final String | REQUIREConstant REQUIRE field. |
public static final String | CONTENT_DISPOSITIONConstant CONTENT_DISPOSITION field. |
public static final String | SUBJECTConstant SUBJECT field. |
public static final String | USER_AGENTConstant USER_AGENT field. |
public static final String | WARNINGConstant WARNING field. |
public static final String | PRIORITYConstant PRIORITY field. |
public static final String | DATEConstant DATE field. |
public static final String | MIN_EXPIRESConstant MIN_EXPIRES field. |
public static final String | EXPIRESConstant EXPIRES field. |
public static final String | RESPONSE_KEYConstant RESPONSE_KEY field. |
public static final String | WARN_AGENTConstant WARN_AGENT field. |
public static final String | SUPPORTEDConstant SUPPORTED field. |
public static final String | EVENTConstant EVENT field. |
public static final String | EXTENSIONConstant EXTENSION field. |
public static final String | SUBSCRIPTION_STATEConstant SUBSCRIPTION_STATE field. |
public static final String | SIP_ETAGConstant SIP_ETAG field (RFC 3903, p. 21). |
public static final String | SIP_IF_MATCHConstant SIP_IF_MATCH field (RFC 3903, p. 22). |
public static final String | REFER_TOConstant Refer-To field (RFC 3515, p. 3). |
public static final String | RSEQConstant RSEQ field (RFC 3262, p. 11). |
public static final String | RACKConstant RAck field (RFC 3262, p. 11). |
public String | headerNameName of the header. |
public String | headerValueValue of the header. |
public static final String[] | parameterLessHeadersArray of the headers that can not have any parameters.
NOTE: If the size of this array is changed,
getStringHash() method also must be changed! |
Methods Summary |
---|
public java.lang.Object | clone()A place holder -- this should be overriden with an actual
clone method.
return this;
|
public java.lang.String | encode()Encodes the header into a String.
if (headerName == null) {
return "";
} else {
return headerName + Separators.COLON + Separators.SP +
encodeBody() + Separators.NEWLINE;
}
|
protected abstract java.lang.String | encodeBody()Gets the stuff that follows the headerName.
|
public static java.lang.String | encodeCalendar(java.util.Calendar date)A utility for encoding dates.
StringBuffer sbuf = new StringBuffer();
int wkday = date.get(Calendar.DAY_OF_WEEK);
switch (wkday) {
case Calendar.MONDAY:
sbuf.append("Mon");
break;
case Calendar.TUESDAY:
sbuf.append("Tue");
break;
case Calendar.WEDNESDAY:
sbuf.append("Wed");
break;
case Calendar.THURSDAY:
sbuf.append("Thu");
break;
case Calendar.FRIDAY:
sbuf.append("Fri");
break;
case Calendar.SATURDAY:
sbuf.append("Sat");
break;
case Calendar.SUNDAY:
sbuf.append("Sun");
break;
default:
new Exception
("bad day of week?? Huh?? " + wkday).printStackTrace();
return null;
}
int day = date.get(Calendar.DAY_OF_MONTH);
if (day < 10) sbuf.append(", 0" + day);
else sbuf.append(", " + day);
sbuf.append(" ");
int month = date.get(Calendar.MONTH);
switch (month) {
case Calendar.JANUARY:
sbuf.append("Jan");
break;
case Calendar.FEBRUARY:
sbuf.append("Feb");
break;
case Calendar.MARCH:
sbuf.append("Mar");
break;
case Calendar.APRIL:
sbuf.append("Apr");
break;
case Calendar.MAY:
sbuf.append("May");
break;
case Calendar.JUNE:
sbuf.append("Jun");
break;
case Calendar.JULY:
sbuf.append("Jul");
break;
case Calendar.AUGUST:
sbuf.append("Aug");
break;
case Calendar.SEPTEMBER:
sbuf.append("Sep");
break;
case Calendar.OCTOBER:
sbuf.append("Oct");
break;
case Calendar.NOVEMBER:
sbuf.append("Nov");
break;
case Calendar.DECEMBER:
sbuf.append("Dec");
break;
default:
return null;
}
sbuf.append(" ");
int year = date.get(Calendar.YEAR);
sbuf.append(year);
sbuf.append(" ");
int hour = date.get(Calendar.HOUR_OF_DAY);
if (hour < 10) sbuf.append("0"+hour);
else sbuf.append(hour);
sbuf.append(":");
int min = date.get(Calendar.MINUTE);
if (min < 10) sbuf.append("0"+min);
else sbuf.append(min);
sbuf.append(":");
int sec = date.get(Calendar.SECOND);
if (sec < 10) sbuf.append("0"+sec);
else sbuf.append(sec);
sbuf.append(" GMT");
return sbuf.toString();
|
public java.lang.String | getHeaderName()Gets the header name.
return this.headerName;
|
public java.lang.String | getHeaderValue()Gets the header value.
return this.encodeBody();
|
public java.lang.String | getName()Alias for getHeaderName.
return this.headerName;
|
public abstract NameValueList | getParameters()Gets the parameters for the header as a nameValue list.
|
public static byte | getStringHash(java.lang.String s)Calculates a signle-byte hash code of the string.
String sl = s.toLowerCase();
int len = sl.length(), headersCount = parameterLessHeaders.length;
int hash = len;
for (int i = 0; i < len; i++) {
hash += sl.charAt(i);
}
hash = (byte)(hash % headersCount);
if (hash == 6) {
hash = (hash + 9 + sl.charAt(0)) % headersCount;
} else if (hash == 7) {
hash = (hash + 13 + sl.charAt(0)) % headersCount;
}
// System.out.println("hash('" + s + "') = " + hash);
return (byte)hash;
|
public abstract java.lang.Object | getValue()Gets the value for the header as opaque object (returned value
will depend upon the header. Note that this is not the same as
the getHeaderValue above.
|
public static boolean | isAuthorization(java.lang.String name)Checks if a header with the given name is an Authorization
or Authentication header.
if (name == null) {
return false;
}
return (name.equalsIgnoreCase(Header.AUTHORIZATION) ||
name.equalsIgnoreCase(Header.PROXY_AUTHORIZATION) ||
name.equalsIgnoreCase(Header.PROXY_AUTHENTICATE) ||
name.equalsIgnoreCase(Header.WWW_AUTHENTICATE));
|
public static boolean | isParameterLess(java.lang.String name)Checks if the specified header can have some parameters.
byte hash;
// IMPL_NOTE: remove!!!
// for (int i = 0; i < parameterLessHeaders.length; i++) {
// if (parameterLessHeaders[i] != null)
// getStringHash(parameterLessHeaders[i]);
// }
hash = getStringHash(name);
return (parameterLessHeaders[hash] != null &&
parameterLessHeaders[hash].equalsIgnoreCase(name));
|
public static boolean | isReliableTagPresent(java.lang.String strOptionTags)Search for the reliable tag, "100rel" in a "Require" Header value.
This method is internally used to identify if the response
received at UAC is reliable provisional response
if (Utils.equalsIgnoreCase(strOptionTags, "100rel")) {
return true;
} else {
String tag = null;
// int tagsLength = strOptionTags.length();
int delimIndex = strOptionTags.indexOf(Separators.COMMA);
while (delimIndex > 0) {
tag = strOptionTags.substring(0, delimIndex).trim();
strOptionTags = strOptionTags.substring(delimIndex + 1,
strOptionTags.length()).trim();
if (Utils.equalsIgnoreCase(tag, "100rel") ||
Utils.equalsIgnoreCase(strOptionTags, "100rel")) {
return true;
}
delimIndex = strOptionTags.indexOf(Separators.COMMA);
}
}
return false;
|
public void | setHeaderName(java.lang.String name)Sets the header name field.
this.headerName = name;
|
public void | setHeaderValue(java.lang.String value)Sets the header value field.
this.headerValue = value;
|
public java.lang.String | toString()Returns the encoded text contents.
return this.encode();
|