/** Alias for getHeaderValue. */ public String getValue() { return this.getHeaderValue(); }
public final String toString() { return this.encode(); } }
public void remove() throws IllegalStateException { if (this.sipHeader == null) throw new IllegalStateException(); if (toRemove) { this.sipHeader = null; this.sipMessage.removeHeader(sipHeader.getName()); } else { throw new IllegalStateException(); } }
/** * Compare for equality. * * @param other -- the other object to compare with. */ public boolean equals(Object other) { if (!other.getClass().equals(this.getClass())) { return false; } SIPMessage otherMessage = (SIPMessage) other; Collection<SIPHeader> values = this.headerTable.values(); Iterator<SIPHeader> it = values.iterator(); if (headerTable.size() != otherMessage.headerTable.size()) { return false; } while (it.hasNext()) { SIPHeader mine = (SIPHeader) it.next(); SIPHeader his = (SIPHeader) (otherMessage.headerTable.get(SIPHeaderNamesCache .toLowerCase(mine.getName()))); if (his == null) { return false; } else if (!his.equals(mine)) { return false; } } return true; }
public Object clone() { PMediaAuthorization retval = (PMediaAuthorization) super.clone(); if (this.token != null) retval.token = this.token; return retval; }
@Override public String getHeaderAsFormattedString(String name) { if(!headersToParse.contains(name.toLowerCase())) { String unparsedHeader = delegate.getHeaderUnparsed(name.toLowerCase()); if(unparsedHeader != null) { return unparsedHeader; } } String lowerCaseName = name.toLowerCase(); if (this.headerTable.containsKey(lowerCaseName)) { return this.headerTable.get(lowerCaseName).toString(); } else { return this.getHeader(name).toString(); } }
/** * Merge a request with a template * * @param template -- template to merge with. * */ public void merge(Object template) { if (!template.getClass().equals(this.getClass())) throw new IllegalArgumentException("Bad class " + template.getClass()); SIPMessage templateMessage = (SIPMessage) template; Object[] templateHeaders = templateMessage.headers.toArray(); for (int i = 0; i < templateHeaders.length; i++) { SIPHeader hdr = (SIPHeader) templateHeaders[i]; String hdrName = hdr.getHeaderName(); List<SIPHeader> myHdrs = this.getHeaderList(hdrName); if (myHdrs == null) { this.attachHeader(hdr); } else { ListIterator<SIPHeader> it = myHdrs.listIterator(); while (it.hasNext()) { SIPHeader sipHdr = (SIPHeader) it.next(); sipHdr.merge(hdr); } } } }
while (li.hasNext()) { SIPHeader hisHeaders = (SIPHeader) li.next(); List<SIPHeader> myHeaders = this.getHeaderList(hisHeaders.getHeaderName()); while (innerIterator.hasNext()) { SIPHeader myHeader = (SIPHeader) innerIterator.next(); if (myHeader.match(hisHeader)) { found = true; break; while (innerIterator.hasNext()) { SIPHeader myHeader = (SIPHeader) innerIterator.next(); if (myHeader.match(hisHeader)) { found = true; break;
/** Get the header value (i.e. what follows the name:). * This merely goes through and lops off the portion that follows * the headerName: */ public String getHeaderValue() { return encodeBody(new StringBuilder()).toString(); }
public boolean equals(Object other) { return (other instanceof PPreferredServiceHeader) && super.equals(other); }
/** * convert to a string representation (for printing). * * @param indentation * int to set * @return String string representation of object (for printing). */ public String debugDump(int indentation) { stringRepresentation = ""; String indent = new Indentation(indentation).getIndentation(); String className = this.getClass().getName(); sprint(indent + className); sprint(indent + "{"); for (Iterator<HDR> it = hlist.iterator(); it.hasNext();) { HDR sipHeader = (HDR) it.next(); sprint(indent + sipHeader.debugDump()); } sprint(indent + "}"); return stringRepresentation; }
/** * Attach a header (replacing the original header). * * @param sipHeader SIPHeader that replaces a header of the same type. */ public void setHeader(Header sipHeader) { SIPHeader header = (SIPHeader) sipHeader; if (header == null) throw new IllegalArgumentException("null header!"); try { if (header instanceof SIPHeaderList) { SIPHeaderList< ? > hl = (SIPHeaderList< ? >) header; // Ignore empty lists. if (hl.isEmpty()) return; } this.removeHeader(header.getHeaderName()); attachHeader(header, true, false); } catch (SIPDuplicateHeaderException ex) { InternalErrorHandler.handleException(ex); } }
String headerNameLowerCase = SIPHeaderNamesCache.toLowerCase(h.getName()); if (replaceFlag) { headerTable.remove(headerNameLowerCase); SIPHeader originalHeader = (SIPHeader) getHeader(header.getName()); while (li.hasNext()) { SIPHeader next = (SIPHeader) li.next(); if (next.equals(originalHeader)) { li.remove();
public Object clone() { Privacy retval = (Privacy) super.clone(); if (this.privacy != null) retval.privacy = this.privacy; return retval; }
@Override public String getHeaderAsFormattedString(String name) { if(!headersToParse.contains(name.toLowerCase())) { String unparsedHeader = delegate.getHeaderUnparsed(name.toLowerCase()); if(unparsedHeader != null) { return unparsedHeader; } } String lowerCaseName = name.toLowerCase(); if (this.headerTable.containsKey(lowerCaseName)) { return this.headerTable.get(lowerCaseName).toString(); } else { return this.getHeader(name).toString(); } }
public StringBuilder encode(StringBuilder buffer) { buffer.append(this.headerName).append(COLON).append(SP); this.encodeBody(buffer); buffer.append(NEWLINE); return buffer; }
public boolean equals(Object other) { return (other instanceof PAssertedServiceHeader) && super.equals(other); }
&& fieldName.compareTo("headers") != 0) { sprint(fieldName + Separators.EQUALS); sprint(((SIPHeader) f.get(this)).debugDump());
/** Encode this header into canonical form. */ public String encode() { return encode(new StringBuilder()).toString(); }
/** * Get the header names. * * @return a list iterator to a list of header names. These are ordered in the same order as * are present in the message. */ public ListIterator<String> getHeaderNames() { Iterator<SIPHeader> li = this.headers.iterator(); LinkedList<String> retval = new LinkedList<String>(); while (li.hasNext()) { SIPHeader sipHeader = (SIPHeader) li.next(); String name = sipHeader.getName(); retval.add(name); } return retval.listIterator(); }