FileDocCategorySizeDatePackage
ParametersParser.javaAPI DocphoneME MR2 API (J2ME)3026Wed May 02 18:00:42 BST 2007gov.nist.siplite.parser

ParametersParser

public abstract class ParametersParser extends HeaderParser
Parameters parser header.
version
JAIN-SIP-1.1 This code is in the public domain.

Fields Summary
protected ParametersHeader
parametersHeader
Current parsed parameters from the header line.
Constructors Summary
protected ParametersParser()
Default constructor.

protected ParametersParser(String buffer)
Constructor with initial parameters header string.

param
buffer initial parameters header

        super(buffer);
    
protected ParametersParser(Lexer lexer)
Constructor with initial lexer engine.

param
lexer initial lexer engine

        super((Lexer)lexer);
    
Methods Summary
protected voidparse(ParametersHeader parametersHeader)
Invokes parser for header field parameters.

param
parametersHeader the parsed header field parameters
exception
ParseException if a parsing error occurs

        this.lexer.SPorHT();
        while (lexer.lookAhead(0) == ';") {
            this.lexer.consume(1);
            // this.lexer.match(';');
            // eat white space
            this.lexer.SPorHT();
            NameValue nv = nameValue();

            // RFC 3261, p. 32:
            // Even though an arbitrary number of parameter pairs may be
            // attached to a header field value, any given parameter-name
            // MUST NOT appear more than once.
            if (parametersHeader.hasParameter(nv.getName())) {
                throw new ParseException("Duplicated parameter: " +
                    nv.getName(), 0);
            }

            parametersHeader.setParameter(nv);

            // eat white space
            this.lexer.SPorHT();
        }