This email continues the previous discussion [1] of conditional headers mentioned in RFC 2732, but not in PushBuilder.
In PushBuilder, we have add/set header through
#addHeader(String name, String value)
#setHeader(String name, String value)
Also, we have the following
i) #eTag(String eTag), #lastModified(String lastModified)
(Per previous discussion in EG, we will rename them as #ifNoneMatch(String), #ifModifiedSince(String). We will use the old name in the following discussion.)
ii) #conditional(boolean)
So if #eTag is invoked with #conditional(false), then the eTag header will not be added.
Suppose we want to add the conditional header:
If-None-Match: ”xyzzy”
Then we can do the following (A):
pushBuilder.eTag(“xyzzy”); (A1)
pushBuilder.conditional(true); (A2)
What is the behavior of invoking (B):
pushBuilder.add(“If-None-Match”, “xyzzy”)
a) (B) = (A1)
But this means that #addHeader will not actually add a conditional header.
b) (B) = (A1) + (A2)
This is problematic here because (A2) is for all conditional headers, not just “If-None-Match”.
c) (B) = adding If-None-Match: “xyzzy” independently of #conditional
This means #conditional(false) will not take effect for those conditional header adding through #addHeader.
d) (B) is illegal, which will throw IllegalArgumentException for any conditional headers.
If we go this way, then we need to add API for the other three conditional headers.
All the above are not quite satisfactory.
Do we still want to keep #eTag, #lastModified, #conditional et al API for conditional headers?
Any comment?
Shing Wai Chan
ps.
[1]
https://java.net/projects/servlet-spec/lists/jsr369-experts/archive/2017-03/message/3