The
IfHeader
class represents the state lists defined through the HTTP
If header, which is specified in RFC 2518 as follows :
If = "If" ":" ( 1*No-tag-list | 1*Tagged-list) No-tag-list = List Tagged-list = Resource 1*List Resource = Coded-URL List = "(" 1*(["Not"](State-etag | "[" entity-tag "]")) ")" State-etag = Coded-URL Coded-URL = "<" absoluteURI ">"
Reformulating this specification into proper EBNF as specified by N. Wirth we get the following productions, which map to the parse METHODS of this class. Any whitespace is ignored except for white space surrounding and within words which is considered significant.
If = "If:" ( Tagged | Untagged ). Tagged = { "<" Word ">" Untagged } . Untagged = { "(" IfList ")" } . IfList = { [ "Not" ] ( ("<" Word ">" ) | ( "[" Word "]" ) ) } . Word = characters .
An If header either contains untagged IfList entries or tagged IfList entries but not a mixture of both. An If header containing tagged entries is said to be of tagged type while an If header containing untagged entries is said to be of untagged type.
An IfList is a list of tokens - words enclosed in < > - and etags - words enclosed in [ ]. An IfList matches a (token, etag) tuple if all entries in the list match. If an entry in the list is prefixed with the word Not (parsed case insensitively) the entry must not match the concrete token or etag.
Example: The ifList (<token> [etag])
only matches if the concret token has the value token
and the conrete etag has the value etag
. On the other hand, the ifList (Not <notoken>)
matches any token which is not notoken
(in this case the concrete value of the etag is not taken into consideration).
@author Felix Meschberger