ReferTo.java revision 600c7a4bbc7348167293eac928192e695b4ad5ba
1/*
2* Conditions Of Use
3*
4* This software was developed by employees of the National Institute of
5* Standards and Technology (NIST), an agency of the Federal Government.
6* Pursuant to title 15 Untied States Code Section 105, works of NIST
7* employees are not subject to copyright protection in the United States
8* and are considered to be in the public domain.  As a result, a formal
9* license is not needed to use the software.
10*
11* This software is provided by NIST as a service and is expressly
12* provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
13* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
15* AND DATA ACCURACY.  NIST does not warrant or make any representations
16* regarding the use of the software or the results thereof, including but
17* not limited to the correctness, accuracy, reliability or usefulness of
18* the software.
19*
20* Permission to use this software is contingent upon your acceptance
21* of the terms of this agreement
22*
23* .
24*
25*/
26
27/*******************************************************************************
28* Product of NIST/ITL Advanced Networking Technologies Division (ANTD).        *
29*******************************************************************************/
30
31package gov.nist.javax.sip.header;
32
33import gov.nist.javax.sip.address.*;
34
35/**
36 * ReferTo SIP Header.
37 *
38 * @version 1.2 $Revision: 1.6 $ $Date: 2009/07/17 18:57:35 $
39 *
40 * @author M. Ranganathan   <br/>
41 * @author Olivier Deruelle <br/>
42 *
43 *
44 *
45 */
46public final class ReferTo
47    extends AddressParametersHeader
48    implements javax.sip.header.ReferToHeader {
49
50    /**
51     * Comment for <code>serialVersionUID</code>
52     */
53    private static final long serialVersionUID = -1666700428440034851L;
54
55    /** default Constructor.
56     */
57    public ReferTo() {
58        super(NAME);
59    }
60
61    /**
62     * Encode the header content into a String.
63     * @return String
64     */
65    protected String encodeBody() {
66        if (address == null)
67            return null;
68        String retval = "";
69        if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
70            retval += LESS_THAN;
71        }
72        retval += address.encode();
73        if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
74            retval += GREATER_THAN;
75        }
76
77        if (!parameters.isEmpty()) {
78            retval += SEMICOLON + parameters.encode();
79        }
80        return retval;
81    }
82}
83/*
84 * $Log: ReferTo.java,v $
85 * Revision 1.6  2009/07/17 18:57:35  emcho
86 * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
87 *
88 * Revision 1.5  2006/07/13 09:01:40  mranga
89 * Issue number:
90 * Obtained from:
91 * Submitted by:  jeroen van bemmel
92 * Reviewed by:   mranga
93 * Moved some changes from jain-sip-1.2 to java.net
94 *
95 * CVS: ----------------------------------------------------------------------
96 * CVS: Issue number:
97 * CVS:   If this change addresses one or more issues,
98 * CVS:   then enter the issue number(s) here.
99 * CVS: Obtained from:
100 * CVS:   If this change has been taken from another system,
101 * CVS:   then name the system in this line, otherwise delete it.
102 * CVS: Submitted by:
103 * CVS:   If this code has been contributed to the project by someone else; i.e.,
104 * CVS:   they sent us a patch or a set of diffs, then include their name/email
105 * CVS:   address here. If this is your work then delete this line.
106 * CVS: Reviewed by:
107 * CVS:   If we are doing pre-commit code reviews and someone else has
108 * CVS:   reviewed your changes, include their name(s) here.
109 * CVS:   If you have not had it reviewed then delete this line.
110 *
111 * Revision 1.3  2006/06/19 06:47:26  mranga
112 * javadoc fixups
113 *
114 * Revision 1.2  2006/06/16 15:26:28  mranga
115 * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
116 *
117 * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
118 *
119 * Import
120 *
121 *
122 * Revision 1.3  2004/01/22 13:26:29  sverker
123 * Issue number:
124 * Obtained from:
125 * Submitted by:  sverker
126 * Reviewed by:   mranga
127 *
128 * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
129 *
130 * CVS: ----------------------------------------------------------------------
131 * CVS: Issue number:
132 * CVS:   If this change addresses one or more issues,
133 * CVS:   then enter the issue number(s) here.
134 * CVS: Obtained from:
135 * CVS:   If this change has been taken from another system,
136 * CVS:   then name the system in this line, otherwise delete it.
137 * CVS: Submitted by:
138 * CVS:   If this code has been contributed to the project by someone else; i.e.,
139 * CVS:   they sent us a patch or a set of diffs, then include their name/email
140 * CVS:   address here. If this is your work then delete this line.
141 * CVS: Reviewed by:
142 * CVS:   If we are doing pre-commit code reviews and someone else has
143 * CVS:   reviewed your changes, include their name(s) here.
144 * CVS:   If you have not had it reviewed then delete this line.
145 *
146 */
147