OK, so I apologize for my ignorance of Java, but I'm hoping you guys
will be willing to bear with me a little bit longer. I thought about
what you said about just working with the interfaces, and thought maybe I
could create my own Header class that does what I want. So I did that:
created a class that implements ExtensionHeader. But when I pass that
in as a header (using addHeader), I get that ClassCastException you were
worried about earlier.
So how is one actually supposed to implement an ExtensionHeader?
I'm imagining there is some basic Java trick that I am missing here....
(Obviously I just did some stub stuff here pending showing that
this is actually going to work)
-------------------------------------------------
package stp;
import javax.sip.header.ExtensionHeader;
public class AsterixTransferHeader implements ExtensionHeader {
private String uri;
public AsterixTransferHeader() {}
public AsterixTransferHeader(String uri) { this.uri = uri; }
public String getName() { return "Contact"; }
public String getValue() { return "Transfer <" + uri + ">"; }
public void setValue(String uri) { this.uri = uri; }
public Object clone() { System.out.println("AsterixTransferHeader.clone called"); return new AsterixTransferHeader(this.uri);}
public boolean equals(Object obj) { System.out.println("AsterixTransferHeader.equals called"); return false;}
public int hashCode() { System.out.println("AsterixTransferHeader.hashCode called"); return super.hashCode();}
public String toString() { return this.getName() + ": " + this.getValue(); }
};
--David
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.