• 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 package gov.nist.javax.sip.parser;
27 
28 import java.text.ParseException;
29 import gov.nist.javax.sip.header.*;
30 
31 /**
32  * Parser for a list of RelpyTo headers.
33  *
34  * @version 1.2 $Revision: 1.7 $ $Date: 2009/07/17 18:58:03 $
35  *
36  * @author Olivier Deruelle   <br/>
37  * @author M. Ranganathan   <br/>
38  *
39  */
40 public class ReplyToParser extends AddressParametersParser {
41 
42     /**
43      * Creates a new instance of ReplyToParser
44      * @param replyTo the header to parse
45      */
ReplyToParser(String replyTo)46     public ReplyToParser(String replyTo) {
47         super(replyTo);
48     }
49 
50     /**
51      * Cosntructor
52      * param lexer the lexer to use to parse the header
53      */
ReplyToParser(Lexer lexer)54     protected ReplyToParser(Lexer lexer) {
55         super(lexer);
56     }
57 
58     /**
59      * parse the String message and generate the ReplyTo List Object
60      * @return SIPHeader the ReplyTo List object
61      * @throws SIPParseException if errors occur during the parsing
62      */
parse()63     public SIPHeader parse() throws ParseException {
64         ReplyTo replyTo = new ReplyTo();
65         if (debug)
66             dbg_enter("ReplyTo.parse");
67 
68         try {
69             headerName(TokenTypes.REPLY_TO);
70 
71             replyTo.setHeaderName(SIPHeaderNames.REPLY_TO);
72 
73             super.parse(replyTo);
74 
75             return replyTo;
76         } finally {
77             if (debug)
78                 dbg_leave("ReplyTo.parse");
79         }
80 
81     }
82 
83     /**
84         public static void main(String args[]) throws ParseException {
85             String r[] = {
86                 "Reply-To: Bob <sip:bob@biloxi.com>\n"
87             };
88 
89             for (int i = 0; i < r.length; i++ ) {
90                 ReplyToParser rt =
91                 new ReplyToParser(r[i]);
92                 ReplyTo re = (ReplyTo) rt.parse();
93                 System.out.println("encoded = " +re.encode());
94             }
95 
96         }
97     */
98 }
99 /*
100  * $Log: ReplyToParser.java,v $
101  * Revision 1.7  2009/07/17 18:58:03  emcho
102  * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project.
103  *
104  * Revision 1.6  2006/07/13 09:02:16  mranga
105  * Issue number:
106  * Obtained from:
107  * Submitted by:  jeroen van bemmel
108  * Reviewed by:   mranga
109  * Moved some changes from jain-sip-1.2 to java.net
110  *
111  * CVS: ----------------------------------------------------------------------
112  * CVS: Issue number:
113  * CVS:   If this change addresses one or more issues,
114  * CVS:   then enter the issue number(s) here.
115  * CVS: Obtained from:
116  * CVS:   If this change has been taken from another system,
117  * CVS:   then name the system in this line, otherwise delete it.
118  * CVS: Submitted by:
119  * CVS:   If this code has been contributed to the project by someone else; i.e.,
120  * CVS:   they sent us a patch or a set of diffs, then include their name/email
121  * CVS:   address here. If this is your work then delete this line.
122  * CVS: Reviewed by:
123  * CVS:   If we are doing pre-commit code reviews and someone else has
124  * CVS:   reviewed your changes, include their name(s) here.
125  * CVS:   If you have not had it reviewed then delete this line.
126  *
127  * Revision 1.3  2006/06/19 06:47:27  mranga
128  * javadoc fixups
129  *
130  * Revision 1.2  2006/06/16 15:26:28  mranga
131  * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak
132  *
133  * Revision 1.1.1.1  2005/10/04 17:12:35  mranga
134  *
135  * Import
136  *
137  *
138  * Revision 1.4  2004/01/22 13:26:31  sverker
139  * Issue number:
140  * Obtained from:
141  * Submitted by:  sverker
142  * Reviewed by:   mranga
143  *
144  * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags.
145  *
146  * CVS: ----------------------------------------------------------------------
147  * CVS: Issue number:
148  * CVS:   If this change addresses one or more issues,
149  * CVS:   then enter the issue number(s) here.
150  * CVS: Obtained from:
151  * CVS:   If this change has been taken from another system,
152  * CVS:   then name the system in this line, otherwise delete it.
153  * CVS: Submitted by:
154  * CVS:   If this code has been contributed to the project by someone else; i.e.,
155  * CVS:   they sent us a patch or a set of diffs, then include their name/email
156  * CVS:   address here. If this is your work then delete this line.
157  * CVS: Reviewed by:
158  * CVS:   If we are doing pre-commit code reviews and someone else has
159  * CVS:   reviewed your changes, include their name(s) here.
160  * CVS:   If you have not had it reviewed then delete this line.
161  *
162  */
163