1 package gov.nist.javax.sip.parser.extensions; 2 3 import gov.nist.core.Token; 4 import gov.nist.javax.sip.header.Reason; 5 import gov.nist.javax.sip.header.ReasonList; 6 import gov.nist.javax.sip.header.SIPHeader; 7 import gov.nist.javax.sip.header.extensions.References; 8 import gov.nist.javax.sip.parser.Lexer; 9 import gov.nist.javax.sip.parser.ParametersParser; 10 import gov.nist.javax.sip.parser.TokenTypes; 11 12 import java.text.ParseException; 13 14 public class ReferencesParser extends ParametersParser { 15 /** 16 * Creates a new instance of ReferencesParser 17 * @param references the header to parse 18 */ ReferencesParser(String references)19 public ReferencesParser(String references) { 20 super(references); 21 } 22 23 /** 24 * Constructor 25 * @param lexer the lexer to use to parse the header 26 */ ReferencesParser(Lexer lexer)27 protected ReferencesParser(Lexer lexer) { 28 super(lexer); 29 } 30 31 /** 32 * parse the String message 33 * @return SIPHeader (ReasonParserList object) 34 * @throws SIPParseException if the message does not respect the spec. 35 */ parse()36 public SIPHeader parse() throws ParseException { 37 38 if (debug) 39 dbg_enter("ReasonParser.parse"); 40 41 try { 42 headerName(TokenTypes.REFERENCES); 43 References references= new References(); 44 this.lexer.SPorHT(); 45 46 String callId = lexer.byteStringNoSemicolon(); 47 48 references.setCallId(callId); 49 super.parse(references); 50 return references; 51 } finally { 52 if (debug) 53 dbg_leave("ReferencesParser.parse"); 54 } 55 56 57 } 58 59 } 60