Examples of SIPHeader


Examples of gov.nist.javax.sip.header.SIPHeader

     * @param top -- flag that indicates which end of header list to process.
     */
    public void removeHeader(String headerName, boolean top) {

        String headerNameLowerCase = SIPHeaderNamesCache.toLowerCase(headerName);
        SIPHeader toRemove = (SIPHeader) headerTable.get(headerNameLowerCase);
        // nothing to do then we are done.
        if (toRemove == null)
            return;
        if (toRemove instanceof SIPHeaderList) {
            SIPHeaderList< ? > hdrList = (SIPHeaderList< ? >) toRemove;
            if (top)
                hdrList.removeFirst();
            else
                hdrList.removeLast();
            // Clean up empty list
            if (hdrList.isEmpty()) {
                Iterator<SIPHeader> li = this.headers.iterator();
                while (li.hasNext()) {
                    SIPHeader sipHeader = (SIPHeader) li.next();
                    if (sipHeader.getName().equalsIgnoreCase(headerNameLowerCase))
                        li.remove();
                }

                // JvB: also remove it from the nameTable! Else NPE in
                // DefaultRouter
                headerTable.remove(headerNameLowerCase);
            }
        } else {
            this.headerTable.remove(headerNameLowerCase);
            if (toRemove instanceof From) {
                this.fromHeader = null;
            } else if (toRemove instanceof To) {
                this.toHeader = null;
            } else if (toRemove instanceof CSeq) {
                this.cSeqHeader = null;
            } else if (toRemove instanceof CallID) {
                this.callIdHeader = null;
            } else if (toRemove instanceof MaxForwards) {
                this.maxForwardsHeader = null;
            } else if (toRemove instanceof ContentLength) {
                this.contentLengthHeader = null;
            }
            Iterator<SIPHeader> li = this.headers.iterator();
            while (li.hasNext()) {
                SIPHeader sipHeader = (SIPHeader) li.next();
                if (sipHeader.getName().equalsIgnoreCase(headerName))
                    li.remove();
            }
        }

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.