jsr369-experts@servlet-spec.java.net

[jsr369-experts] Re: SERVLET_SPEC-171: Behaviors of returned Set

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Thu, 23 Mar 2017 14:45:19 -0700

Any comments on the following?
Shing Wai Chan

> On Mar 21, 2017, at 3:40 PM, Shing Wai Chan <shing.wai.chan_at_oracle.com> wrote:
>
> In Servlet API, the following API returns a Set:
>
> (i) PushBuilder: public Set<String> getHeaderNames();
> (ii) ServletContext: public Set<String> getResourcePaths(String path);
> (iii) ServletContext: public Set<SessionTrackingMode> getDefaultSessionTrackingModes();
> (iv) ServletContext: public Set<SessionTrackingMode> getEffectiveSessionTrackingModes();
>
> (v) Registration: public Set<String> setInitParameters(Map<String, String> initParameters);
> (vi) ServletRegistration: public Set<String> addMapping(String... urlPatterns);
> (vii) ServletRegistration.Dynamic: public Set<String> setServletSecurity(ServletSecurityElement constraint);
>
> For (i)-(iv), the returned set is from getter.
> For (v)-(vii), the returned set is about conflicts.
>
> The javadoc and spec does not mention the behavior of the returned Set.
>
> For convenience, we will look at PushBuilder, (i) above, in the following wordings.
> There are two options:
> a) Backed:
> The returned set is backed by the PushBuilder, so changes in the returned set
> are reflected in the PushBuilder, and vice-versa.
> b) NonBacked:
> The returned set is not backed by the PushBuilder, so changes in the returned
> set are not reflected in the PushBuilder, and vice-versa.
>
> Please weigh in on this by close business Friday 24 March 2017.
> In the absence of any discussion, we'll go with the "NonBacked” option for (i)-(vii) above.
>
> Thanks.
> Shing Wai Chan
>