• 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 java.text.ParseException;
32 import javax.sip.header.*;
33 
34 /**
35  * Supported SIP Header.
36  *
37  * @version 1.2 $Revision: 1.5 $ $Date: 2009/07/17 18:57:39 $
38  *
39  * @author M. Ranganathan   <br/>
40  * @author Olivier Deruelle <br/>
41  *
42  *
43  *
44  */
45 public class Supported extends SIPHeader implements SupportedHeader {
46 
47     /**
48      * Comment for <code>serialVersionUID</code>
49      */
50     private static final long serialVersionUID = -7679667592702854542L;
51     /* the Option field
52      */
53     protected String optionTag;
54 
55     /**
56      * default constructor
57      */
Supported()58     public Supported() {
59         super(SIPHeaderNames.SUPPORTED);
60         optionTag = null;
61     }
62 
63     /**
64      * Constructor
65      * @param option_tag String to set
66      */
Supported(String option_tag)67     public Supported(String option_tag) {
68         super(SIPHeaderNames.SUPPORTED);
69         optionTag = option_tag;
70     }
71 
72     /**
73      * Return canonical form of the header.
74      * @return encoded header.
75      */
encode()76     public String encode() {
77         String retval = headerName + COLON;
78         if (optionTag != null)
79             retval += SP + optionTag;
80         retval += NEWLINE;
81         return retval;
82     }
83 
84     /**
85      * Just the encoded body of the header.
86      * @return the string encoded header body.
87      */
encodeBody()88     public String encodeBody() {
89         return optionTag != null ? optionTag : "";
90     }
91 
92     /**
93      * Sets the option tag value to the new supplied <var>optionTag</var>
94      * parameter.
95      *
96      * @param optionTag - the new string value of the option tag.
97      * @throws ParseException which signals that an error has been reached
98      * unexpectedly while parsing the optionTag value.
99      */
setOptionTag(String optionTag)100     public void setOptionTag(String optionTag) throws ParseException {
101         if (optionTag == null)
102             throw new NullPointerException(
103                 "JAIN-SIP Exception, Supported, "
104                     + "setOptionTag(), the optionTag parameter is null");
105         this.optionTag = optionTag;
106     }
107 
108     /**
109      * Gets the option tag of this OptionTag class.
110      *
111      * @return the string that identifies the option tag value.
112      */
getOptionTag()113     public String getOptionTag() {
114         return optionTag;
115     }
116 }
117 /*
118  * $Log: Supported.java,v $
119  * Revision 1.5  2009/07/17 18:57:39  emcho
120  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
121  *
122  * Revision 1.4  2006/07/13 09:01:27  mranga
123  * Issue number:
124  * Obtained from:
125  * Submitted by:  jeroen van bemmel
126  * Reviewed by:   mranga
127  * Moved some changes from jain-sip-1.2 to java.net
128  *
129  * CVS: ----------------------------------------------------------------------
130  * CVS: Issue number:
131  * CVS:   If this change addresses one or more issues,
132  * CVS:   then enter the issue number(s) here.
133  * CVS: Obtained from:
134  * CVS:   If this change has been taken from another system,
135  * CVS:   then name the system in this line, otherwise delete it.
136  * CVS: Submitted by:
137  * CVS:   If this code has been contributed to the project by someone else; i.e.,
138  * CVS:   they sent us a patch or a set of diffs, then include their name/email
139  * CVS:   address here. If this is your work then delete this line.
140  * CVS: Reviewed by:
141  * CVS:   If we are doing pre-commit code reviews and someone else has
142  * CVS:   reviewed your changes, include their name(s) here.
143  * CVS:   If you have not had it reviewed then delete this line.
144  *
145  * Revision 1.3  2006/06/19 06:47:27  mranga
146  * javadoc fixups
147  *
148  * Revision 1.2  2006/06/16 15:26:28  mranga
149  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
150  *
151  * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
152  *
153  * Import
154  *
155  *
156  * Revision 1.2  2004/01/22 13:26:30  sverker
157  * Issue number:
158  * Obtained from:
159  * Submitted by:  sverker
160  * Reviewed by:   mranga
161  *
162  * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
163  *
164  * CVS: ----------------------------------------------------------------------
165  * CVS: Issue number:
166  * CVS:   If this change addresses one or more issues,
167  * CVS:   then enter the issue number(s) here.
168  * CVS: Obtained from:
169  * CVS:   If this change has been taken from another system,
170  * CVS:   then name the system in this line, otherwise delete it.
171  * CVS: Submitted by:
172  * CVS:   If this code has been contributed to the project by someone else; i.e.,
173  * CVS:   they sent us a patch or a set of diffs, then include their name/email
174  * CVS:   address here. If this is your work then delete this line.
175  * CVS: Reviewed by:
176  * CVS:   If we are doing pre-commit code reviews and someone else has
177  * CVS:   reviewed your changes, include their name(s) here.
178  * CVS:   If you have not had it reviewed then delete this line.
179  *
180  */
181