/** * parse the Accept String header * * @return SIPHeader (AcceptList object) * @throws SIPParseException if the message does not respect the spec. */ public SIPHeader parse() throws ParseException { if (debug) dbg_enter("AcceptParser.parse"); AcceptList list = new AcceptList(); try { headerName(TokenTypes.ACCEPT); Accept accept = new Accept(); accept.setHeaderName(SIPHeaderNames.ACCEPT); this.lexer.SPorHT(); this.lexer.match(TokenTypes.ID); Token token = lexer.getNextToken(); accept.setContentType(token.getTokenValue()); this.lexer.match('/'); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); accept.setContentSubType(token.getTokenValue()); this.lexer.SPorHT(); super.parse(accept); list.add(accept); while (lexer.lookAhead(0) == ',') { this.lexer.match(','); this.lexer.SPorHT(); accept = new Accept(); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); accept.setContentType(token.getTokenValue()); this.lexer.match('/'); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); accept.setContentSubType(token.getTokenValue()); this.lexer.SPorHT(); super.parse(accept); list.add(accept); } return list; } finally { if (debug) dbg_leave("AcceptParser.parse"); } }
@Override public Object clone() { AcceptList retval = new AcceptList(); retval.clonehlist(this.hlist); return retval; }