Re: Why are the header classes final?

"Jeroen van Bemmel" <[email protected]>
Newsgroups gmane.comp.voip.nist-sip
Message-ID <003d01c703cc$24d7c280$0601a8c0@BEMBUSTER>
final helps improve performance, and it also helps us to detect when people 
are trying to do things that they shouldn't (no offence). Trying to add a 
subclassed header to a message will possibly give ClassCastExceptions. It 
would actually be better to make all header implementations final

jeroen

M. Rangnathan wrote:
> Well, Asterisk seems to have a bug. The quotes should not matter.  I
> can see no good reason for not making the class final. However, there
> is also no good reason to make that class final so I  just remove the
> final keyword. :-)
>
> Its quite simple you see...
>
>
> Ranga
>
> [email protected] wrote:
>
>> On Wed, 8 Nov 2006 at 20:53, Jeroen van Bemmel wrote:
>>
>>> They are not all final, but in any case the public interfaces of
>>> this library are in javax.sip (and javax.sdp). The design is such
>>> that an application would only deal with those packages.
>>
>>
>> So why is gov.nist.javax.sip.header.Contact final if not all the
>> headers are?  Like I said, I'm new to Java so I don't know the
>> motivations for using final.
>>
>>> Which need do you have that it cannot be done using the public API?
>>
>>
>> Well, we're trying to send a Response.MOVED_TEMPORARILY to Asterix
>> boxes, and we were told on the Asterix mailing list that Asterix
>> wouldn't recognize it unless the form of the Contact header
>> in the response was:
>>
>>     Contact: Transfer <uri>
>>
>> I tried just using Transfer as the DisplayName, but that produces:
>>
>>     Contact: "Transfer" <uri>
>>
>> and that doesn't seem to be good enough.  Now, I'm not personally
>> convinced that even getting rid of the quotes is going to fix the
>> problem with Asterix, but I need to run the experiment.  So I was
>> going to subclass Contact and change the toString so that there
>> were no quotes around Transfer, and use my custom header in
>> constructing the response.
>>
>> --David
>> _______________________________________________
>> nist-sip mailing list
>> [email protected]
>> http://www-x.antd.nist.gov/mailman/listinfo/nist-sip
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.