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

ToParser

public class ToParser extends AddressParametersParser
To Header parser.
version
JAIN-SIP-1.1 This code is in the public domain.

Fields Summary
Constructors Summary
protected ToParser()
Default constructor.

public ToParser(String to)
Creates new ToParser with initial To header.

param
to String to set

        super(to);
    
protected ToParser(Lexer lexer)
Constructor with initial lexer engine.

param
lexer initial lexer engine

        super(lexer);
    
Methods Summary
public Headerparse()
Invokes parser for To header field.

return
the parsed To header
exception
ParseException if a parsing error occurs

        
        headerName(TokenTypes.TO);
        ToHeader to = new ToHeader();
        super.parse(to);
        this.lexer.match('\n");
        if (((Address)to.getAddress()).getAddressType() ==
                Address.ADDRESS_SPEC) {
            // the parameters are header parameters.
            if (to.getAddress().getURI() instanceof SipURI) {
                SipURI sipUri = (SipURI) to.getAddress().getURI();
                NameValueList parms = sipUri.getUriParms();
                if (parms != null && ! parms.isEmpty()) {
                    to.setParameters(parms);
                    sipUri.removeUriParms();
                }
            }
        }
        return to;