Thursday Nov 20, 2008

Parameterable Headers in SailFin

Headers which have "field-name: field-value \*(;parameter-name=parameter-value)" have a direct support for manipulating headers in JSR 289 and referred as Parameterable Headers. javax.servlet.sip.Parameterable interface defines the contract for Parameterable header, javax.servlet.sip.SipFactory.createParameterable(String) helps in creating a Parameterable and javax.servlet.sip.ServletMessage getters and setters helps in adding and retrieves headers in Parameterable form.

According to the JSR 289, a Parameterable header should be interpreted as "field-value \*(;parameter-name[=parameter-value])"
where the field-value may be in name-addr or addr-spec format as defined in RFC 3261 or may be any sequence of tokens till the first semicolon.

With the above interpretation, almost all the headers would be qualified as Parameterable headers, and there is away to create Parameterable but then there is a restriction while adding the created Parameterable to the message as the JSR 289 disallows any header, whose form is not the form in its BNF.


SipServletMessage.addParameterableHeader(..)
java.lang.IllegalArgumentException - if the specified header is not defined to hold Parameterable values or if the specified header field is a system header

With this the implementation is in a tricky situation and it has to know before hand, what are all the headers which have Parameterable header form, if not for the extension headers, this task is not overly complex. Since some of the extension headers defined by other RFCs might have Parameterable form, there should be a way of extending the list of headers, which takes Parameterable form.

SailFin's Parameterable implementation has been extended so that there is a configurable way of allowing any header to be added to SipServletMessage as a Parameterable. Two system properties which effect this behaviour are:
1) org.glassfish.sip.parameterablecheck : This property can be set to to false to allow any header name to be added to the message as a Parameterable as long as it follows Parameterable's BNF.

Example, the domain.xml:
-Dorg.glassfish.sip.parameterablecheck=false

2) org.glassfish.sip.parameterablelist : This property can be used to specify the explicit list of header names to be considered as Parameterable headers. Union of predefined Parameterable headers as specified in the 4.2.1 of the JSR 289 spec
and this list will be considered as the list of Parameterable headers.

Example, in the domain.xml:
-Dorg.glassfish.sip.parameterablelist=Header1,Header2

We hope, predefined parameterable headers are good enough for most users and where it is not sufficient, above mechanism can be used.

About

bsankararao

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today