• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 * Product of NIST/ITL Advanced Networking Technologies Division (ANTD).        *
28 *******************************************************************************/
29 package gov.nist.javax.sip.header;
30 
31 import gov.nist.core.*;
32 import gov.nist.javax.sip.address.*;
33 import javax.sip.header.*;
34 
35 /**
36  * ReplyTo Header.
37  *
38  * @version 1.2 $Revision: 1.5 $ $Date: 2009/07/17 18:57:36 $
39  *
40  * @author M. Ranganathan   <br/>
41  * @author Olivier Deruelle <br/>
42  *
43  *
44  *
45  */
46 public final class ReplyTo
47     extends AddressParametersHeader
48     implements ReplyToHeader {
49 
50     /**
51      * Comment for <code>serialVersionUID</code>
52      */
53     private static final long serialVersionUID = -9103698729465531373L;
54 
55     /** Default constructor
56      */
ReplyTo()57     public ReplyTo() {
58         super(NAME);
59     }
60 
61     /** Default constructor given an address.
62      *
63      *@param address -- address of this header.
64      *
65      */
ReplyTo(AddressImpl address)66     public ReplyTo(AddressImpl address) {
67         super(NAME);
68         this.address = address;
69     }
70 
71     /**
72      * Encode the header into a String.
73      * @return String
74      */
encode()75     public String encode() {
76         return headerName + COLON + SP + encodeBody() + NEWLINE;
77     }
78 
79     /**
80      * Encode the header content into a String.
81      * @return String
82      */
encodeBody()83     public String encodeBody() {
84         String retval = "";
85         if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
86             retval += LESS_THAN;
87         }
88         retval += address.encode();
89         if (address.getAddressType() == AddressImpl.ADDRESS_SPEC) {
90             retval += GREATER_THAN;
91         }
92         if (!parameters.isEmpty()) {
93             retval += SEMICOLON + parameters.encode();
94         }
95         return retval;
96     }
97 
98     /**
99      * Conveniance accessor function to get the hostPort field from the address
100      * @return HostPort
101      */
getHostPort()102     public HostPort getHostPort() {
103         return address.getHostPort();
104     }
105 
106     /**
107      * Get the display name from the address.
108      * @return String
109      */
getDisplayName()110     public String getDisplayName() {
111         return address.getDisplayName();
112     }
113 }
114 /*
115  * $Log: ReplyTo.java,v $
116  * Revision 1.5  2009/07/17 18:57:36  emcho
117  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
118  *
119  * Revision 1.4  2006/07/13 09:01:31  mranga
120  * Issue number:
121  * Obtained from:
122  * Submitted by:  jeroen van bemmel
123  * Reviewed by:   mranga
124  * Moved some changes from jain-sip-1.2 to java.net
125  *
126  * CVS: ----------------------------------------------------------------------
127  * CVS: Issue number:
128  * CVS:   If this change addresses one or more issues,
129  * CVS:   then enter the issue number(s) here.
130  * CVS: Obtained from:
131  * CVS:   If this change has been taken from another system,
132  * CVS:   then name the system in this line, otherwise delete it.
133  * CVS: Submitted by:
134  * CVS:   If this code has been contributed to the project by someone else; i.e.,
135  * CVS:   they sent us a patch or a set of diffs, then include their name/email
136  * CVS:   address here. If this is your work then delete this line.
137  * CVS: Reviewed by:
138  * CVS:   If we are doing pre-commit code reviews and someone else has
139  * CVS:   reviewed your changes, include their name(s) here.
140  * CVS:   If you have not had it reviewed then delete this line.
141  *
142  * Revision 1.3  2006/06/19 06:47:26  mranga
143  * javadoc fixups
144  *
145  * Revision 1.2  2006/06/16 15:26:28  mranga
146  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
147  *
148  * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
149  *
150  * Import
151  *
152  *
153  * Revision 1.2  2004/01/22 13:26:29  sverker
154  * Issue number:
155  * Obtained from:
156  * Submitted by:  sverker
157  * Reviewed by:   mranga
158  *
159  * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
160  *
161  * CVS: ----------------------------------------------------------------------
162  * CVS: Issue number:
163  * CVS:   If this change addresses one or more issues,
164  * CVS:   then enter the issue number(s) here.
165  * CVS: Obtained from:
166  * CVS:   If this change has been taken from another system,
167  * CVS:   then name the system in this line, otherwise delete it.
168  * CVS: Submitted by:
169  * CVS:   If this code has been contributed to the project by someone else; i.e.,
170  * CVS:   they sent us a patch or a set of diffs, then include their name/email
171  * CVS:   address here. If this is your work then delete this line.
172  * CVS: Reviewed by:
173  * CVS:   If we are doing pre-commit code reviews and someone else has
174  * CVS:   reviewed your changes, include their name(s) here.
175  * CVS:   If you have not had it reviewed then delete this line.
176  *
177  */
178