| 1 |
|
| 2 |
/******************************************************************************* |
| 3 |
* Product of NIST/ITL Advanced Networking Technologies Division (ANTD). * |
| 4 |
*******************************************************************************/ |
| 5 |
|
| 6 |
package gov.nist.javax.sip.header.extensions; |
| 7 |
|
| 8 |
import java.text.ParseException; |
| 9 |
|
| 10 |
import javax.sip.header.ExtensionHeader; |
| 11 |
import gov.nist.javax.sip.header.*; |
| 12 |
|
| 13 |
import gov.nist.javax.sip.address.*; |
| 14 |
/* |
| 15 |
* This code has been contributed by the author to the public domain. |
| 16 |
*/ |
| 17 |
|
| 18 |
/** |
| 19 |
* ReferredBy SIP Header. RFC 3892 |
| 20 |
* |
| 21 |
* @version JAIN-SIP-1.2 |
| 22 |
* |
| 23 |
* @author Peter Musgrave. |
| 24 |
* |
| 25 |
* |
| 26 |
*/ |
| 27 |
public final class ReferredBy |
| 28 |
extends AddressParametersHeader implements ExtensionHeader, ReferredByHeader { |
| 29 |
|
| 30 |
// TODO: Need a unique UID |
| 31 |
private static final long serialVersionUID = 3134344915465784267L; |
| 32 |
|
| 33 |
// TODO: When the MinSEHeader is added to javax - move this there...pmusgrave |
| 34 |
public static final String NAME = "Referred-By"; |
| 35 |
|
| 36 |
/** default Constructor. |
| 37 |
*/ |
| 38 |
public ReferredBy() { |
| 39 |
super(NAME); |
| 40 |
} |
| 41 |
|
| 42 |
public void setValue(String value) throws ParseException { |
| 43 |
// not implemented. |
| 44 |
throw new ParseException(value,0); |
| 45 |
|
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Encode the header content into a String. |
| 50 |
* @return String |
| 51 |
*/ |
| 52 |
protected String encodeBody() { |
| 53 |
if (address == null) |
| 54 |
return null; |
| 55 |
String retval = ""; |
| 56 |
if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) { |
| 57 |
retval += LESS_THAN; |
| 58 |
} |
| 59 |
retval += address.encode(); |
| 60 |
if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) { |
| 61 |
retval += GREATER_THAN; |
| 62 |
} |
| 63 |
|
| 64 |
if (!parameters.isEmpty()) { |
| 65 |
retval += SEMICOLON + parameters.encode(); |
| 66 |
} |
| 67 |
return retval; |
| 68 |
} |
| 69 |
} |
| 70 |
/* |
| 71 |
* $Log: ReferredBy.java,v $ |
| 72 |
* Revision 1.3 2009/07/17 18:57:42 emcho |
| 73 |
* Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project. |
| 74 |
* |
| 75 |
* Revision 1.2 2006/10/27 20:58:31 mranga |
| 76 |
* Issue number: |
| 77 |
* Obtained from: |
| 78 |
* Submitted by: |
| 79 |
* Reviewed by: mranga |
| 80 |
* doc fixups |
| 81 |
* CVS: ---------------------------------------------------------------------- |
| 82 |
* CVS: Issue number: |
| 83 |
* CVS: If this change addresses one or more issues, |
| 84 |
* CVS: then enter the issue number(s) here. |
| 85 |
* CVS: Obtained from: |
| 86 |
* CVS: If this change has been taken from another system, |
| 87 |
* CVS: then name the system in this line, otherwise delete it. |
| 88 |
* CVS: Submitted by: |
| 89 |
* CVS: If this code has been contributed to the project by someone else; i.e., |
| 90 |
* CVS: they sent us a patch or a set of diffs, then include their name/email |
| 91 |
* CVS: address here. If this is your work then delete this line. |
| 92 |
* CVS: Reviewed by: |
| 93 |
* CVS: If we are doing pre-commit code reviews and someone else has |
| 94 |
* CVS: reviewed your changes, include their name(s) here. |
| 95 |
* CVS: If you have not had it reviewed then delete this line. |
| 96 |
* |
| 97 |
* Revision 1.1 2006/10/12 11:57:52 pmusgrave |
| 98 |
* Issue number: 79, 80 |
| 99 |
* Submitted by: [email protected] |
| 100 |
* Reviewed by: mranga |
| 101 |
* |
| 102 |
* Revision 1.2 2006/03/20 20:52:03 pmusgrave |
| 103 |
* Add RefferedBy to header factory |
| 104 |
* Correct implements statement in ReferredBy |
| 105 |
* |
| 106 |
* Revision 1.1.1.1 2006/03/15 16:00:07 pmusgrave |
| 107 |
* Source with additions |
| 108 |
* |
| 109 |
* Revision 1.3 2004/01/22 13:26:29 sverker |
| 110 |
* Issue number: |
| 111 |
* Obtained from: |
| 112 |
* Submitted by: sverker |
| 113 |
* Reviewed by: mranga |
| 114 |
* |
| 115 |
* Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags. |
| 116 |
* |
| 117 |
* CVS: ---------------------------------------------------------------------- |
| 118 |
* CVS: Issue number: |
| 119 |
* CVS: If this change addresses one or more issues, |
| 120 |
* CVS: then enter the issue number(s) here. |
| 121 |
* CVS: Obtained from: |
| 122 |
* CVS: If this change has been taken from another system, |
| 123 |
* CVS: then name the system in this line, otherwise delete it. |
| 124 |
* CVS: Submitted by: |
| 125 |
* CVS: If this code has been contributed to the project by someone else; i.e., |
| 126 |
* CVS: they sent us a patch or a set of diffs, then include their name/email |
| 127 |
* CVS: address here. If this is your work then delete this line. |
| 128 |
* CVS: Reviewed by: |
| 129 |
* CVS: If we are doing pre-commit code reviews and someone else has |
| 130 |
* CVS: reviewed your changes, include their name(s) here. |
| 131 |
* CVS: If you have not had it reviewed then delete this line. |
| 132 |
* |
| 133 |
*/ |
| 134 |
|