On 07/02/17 22:04, Martin Mulholland wrote:
> Hi,
>
> I am looking at the PushBuilder api and think we need some
> clarifications and/or updates. This is mostly based on the javadoc with
> the first draft so apologize if these things have already been covered,
> but I couldn't find anything in the history:
>
> In no particular order.
>
> - pushBuilder.getHeaderNames() returns Set<String> whereas the same
> method on HttpServlerRequest returns an Enumeration<String>. This is
> inconsistent and pushBuilder should also return an enumeration.
It needs to be a set so entries can be removed.
> - pushBuilder.push() involves a request and a response which makes, for
> example, the pushBuilder.setHeader() method ambiguous. Is it setting
> header for the request or the response? If it is the request what if a
> response header is set, if it is the response what if a response header
> is set, if it is based on the type of header what if a general header is
> set?
Always request headers.
> - Should the pushbuilder.setMethod() API not throw an
> unsupportedMethodException for invalid methods?
The best the container can do here is "Is that an RFC 7230 token or not?"
What about query string? Header names? Header values?
Given that the app should know what it is doing, I'm in favour of not
validating any of this (it wastes CPU cycles for well written apps) and
let the container generate a 4xx response for broken requests.
> - The javadoc says that the eTag and lastModified values must be cleared
> after a call to push, if associated headers were set I assume they
> should also be cleared.
N/A. Those are response headers.
Mark