ContentDispositionParser.java revision 600c7a4bbc7348167293eac928192e695b4ad5ba
1b0fe1620dcb4135ac3ab2d66ff93072373911299Ben Murdoch/* 281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* Conditions Of Use 381362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* 481362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* This software was developed by employees of the National Institute of 581362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* Standards and Technology (NIST), an agency of the Federal Government. 681362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* Pursuant to title 15 Untied States Code Section 105, works of NIST 781362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* employees are not subject to copyright protection in the United States 881362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* and are considered to be in the public domain. As a result, a formal 981362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* license is not needed to use the software. 1081362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* 1181362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* This software is provided by NIST as a service and is expressly 1281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 1381362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 1481362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 1581362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* AND DATA ACCURACY. NIST does not warrant or make any representations 1681362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* regarding the use of the software or the results thereof, including but 1781362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* not limited to the correctness, accuracy, reliability or usefulness of 1881362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* the software. 1981362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* 2081362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* Permission to use this software is contingent upon your acceptance 2181362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* of the terms of this agreement 2281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* 2381362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* . 2481362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen* 2581362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen*/ 2681362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsenpackage gov.nist.javax.sip.parser; 2781362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen 28b0fe1620dcb4135ac3ab2d66ff93072373911299Ben Murdochimport gov.nist.javax.sip.header.*; 29b0fe1620dcb4135ac3ab2d66ff93072373911299Ben Murdochimport gov.nist.core.*; 3081362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsenimport java.text.ParseException; 31b0fe1620dcb4135ac3ab2d66ff93072373911299Ben Murdoch 3281362e16c30e9e970af6b17592f627ad8cdee4d8Kristian Monsen/** 33b0fe1620dcb4135ac3ab2d66ff93072373911299Ben Murdoch * Parser for ContentLanguage header. 34 * 35 * @version 1.2 $Revision: 1.8 $ $Date: 2009/07/17 18:57:58 $ 36 * 37 * @author Olivier Deruelle <br/> 38 * @author M. Ranganathan <br/> 39 * 40 * 41 */ 42public class ContentDispositionParser extends ParametersParser { 43 44 /** 45 * Creates a new instance of ContentDispositionParser 46 * @param contentDisposition the header to parse 47 */ 48 public ContentDispositionParser(String contentDisposition) { 49 super(contentDisposition); 50 } 51 52 /** 53 * Constructor 54 * @param lexer the lexer to use to parse the header 55 */ 56 protected ContentDispositionParser(Lexer lexer) { 57 super(lexer); 58 } 59 60 /** 61 * parse the ContentDispositionHeader String header 62 * @return SIPHeader (ContentDispositionList object) 63 * @throws SIPParseException if the message does not respect the spec. 64 */ 65 public SIPHeader parse() throws ParseException { 66 67 if (debug) 68 dbg_enter("ContentDispositionParser.parse"); 69 70 try { 71 headerName(TokenTypes.CONTENT_DISPOSITION); 72 73 ContentDisposition cd = new ContentDisposition(); 74 cd.setHeaderName(SIPHeaderNames.CONTENT_DISPOSITION); 75 76 this.lexer.SPorHT(); 77 this.lexer.match(TokenTypes.ID); 78 79 Token token = lexer.getNextToken(); 80 cd.setDispositionType(token.getTokenValue()); 81 this.lexer.SPorHT(); 82 super.parse(cd); 83 84 this.lexer.SPorHT(); 85 this.lexer.match('\n'); 86 87 return cd; 88 } catch (ParseException ex) { 89 throw createParseException(ex.getMessage()); 90 } finally { 91 if (debug) 92 dbg_leave("ContentDispositionParser.parse"); 93 } 94 } 95 96 97} 98/* 99 * $Log: ContentDispositionParser.java,v $ 100 * Revision 1.8 2009/07/17 18:57:58 emcho 101 * Converts indentation tabs to spaces so that we have a uniform indentation policy in the whole project. 102 * 103 * Revision 1.7 2006/07/13 09:02:15 mranga 104 * Issue number: 105 * Obtained from: 106 * Submitted by: jeroen van bemmel 107 * Reviewed by: mranga 108 * Moved some changes from jain-sip-1.2 to java.net 109 * 110 * CVS: ---------------------------------------------------------------------- 111 * CVS: Issue number: 112 * CVS: If this change addresses one or more issues, 113 * CVS: then enter the issue number(s) here. 114 * CVS: Obtained from: 115 * CVS: If this change has been taken from another system, 116 * CVS: then name the system in this line, otherwise delete it. 117 * CVS: Submitted by: 118 * CVS: If this code has been contributed to the project by someone else; i.e., 119 * CVS: they sent us a patch or a set of diffs, then include their name/email 120 * CVS: address here. If this is your work then delete this line. 121 * CVS: Reviewed by: 122 * CVS: If we are doing pre-commit code reviews and someone else has 123 * CVS: reviewed your changes, include their name(s) here. 124 * CVS: If you have not had it reviewed then delete this line. 125 * 126 * Revision 1.3 2006/06/19 06:47:27 mranga 127 * javadoc fixups 128 * 129 * Revision 1.2 2006/06/16 15:26:28 mranga 130 * Added NIST disclaimer to all public domain files. Clean up some javadoc. Fixed a leak 131 * 132 * Revision 1.1.1.1 2005/10/04 17:12:35 mranga 133 * 134 * Import 135 * 136 * 137 * Revision 1.5 2004/07/28 14:13:55 mranga 138 * Submitted by: mranga 139 * 140 * Move out the test code to a separate test/unit class. 141 * Fixed some encode methods. 142 * 143 * Revision 1.4 2004/01/22 13:26:31 sverker 144 * Issue number: 145 * Obtained from: 146 * Submitted by: sverker 147 * Reviewed by: mranga 148 * 149 * Major reformat of code to conform with style guide. Resolved compiler and javadoc warnings. Added CVS tags. 150 * 151 * CVS: ---------------------------------------------------------------------- 152 * CVS: Issue number: 153 * CVS: If this change addresses one or more issues, 154 * CVS: then enter the issue number(s) here. 155 * CVS: Obtained from: 156 * CVS: If this change has been taken from another system, 157 * CVS: then name the system in this line, otherwise delete it. 158 * CVS: Submitted by: 159 * CVS: If this code has been contributed to the project by someone else; i.e., 160 * CVS: they sent us a patch or a set of diffs, then include their name/email 161 * CVS: address here. If this is your work then delete this line. 162 * CVS: Reviewed by: 163 * CVS: If we are doing pre-commit code reviews and someone else has 164 * CVS: reviewed your changes, include their name(s) here. 165 * CVS: If you have not had it reviewed then delete this line. 166 * 167 */ 168