/** * Creates a new AllowHeader based on the newly supplied method value. * * @param method - the new string containing the method value. * @throws ParseException which signals that an error has been reached * unexpectedly while parsing the method value. * @return the newly created AllowHeader object. */ public AllowHeader createAllowHeader(String method) throws ParseException { if (method == null) throw new NullPointerException("null arg method"); Allow allow = new Allow(); allow.setMethod(method); return allow; }
/** * Gets an Iterator of all the methods of the AllowHeader. Returns an empty * * Iterator if no methods are defined in this Allow Header. * * * * @return Iterator of String objects each identifing the methods of * * AllowHeader. * * */ public ListIterator<String> getMethods() { LinkedList<String> ll = new LinkedList<String> (); for ( Iterator<Allow> it = this.hlist.iterator(); it.hasNext();) { Allow a = (Allow)it.next(); ll.add(a.getMethod()); } return ll.listIterator(); }
headerName(TokenTypes.ALLOW); Allow allow = new Allow(); allow.setHeaderName(SIPHeaderNames.ALLOW); allow.setMethod(token.getTokenValue()); this.lexer.SPorHT(); allow = new Allow(); this.lexer.match(TokenTypes.ID); token = lexer.getNextToken(); allow.setMethod(token.getTokenValue());
/** * Sets the methods supported defined by this AllowHeader. * * * * @param methods - the Iterator of Strings defining the methods supported * * in this AllowHeader * * @throws ParseException which signals that an error has been reached * * unexpectedly while parsing the Strings defining the methods supported. * * */ public void setMethods(List<String> methods) throws ParseException { ListIterator<String> it = methods.listIterator(); while (it.hasNext()) { Allow allow = new Allow(); allow.setMethod((String) it.next()); this.add(allow); } } }
headerName(TokenTypes.ALLOW); Allow allow = new Allow(); list.add(allow); if ( lexer.startsId() ) { Token token = this.lexer.match(TokenTypes.ID); allow.setMethod(token.getTokenValue()); this.lexer.SPorHT(); while (lexer.lookAhead(0) == ',') { this.lexer.SPorHT(); allow = new Allow(); token = this.lexer.match(TokenTypes.ID); allow.setMethod(token.getTokenValue()); list.add(allow); this.lexer.SPorHT();