Since there is a concern on #isDistributable and #setDistributable, I will hold on for these two API
and only add get/setSessionTimeout.
Shing Wai Chan
> On Jan 25, 2017, at 1:15 PM, Shing Wai Chan <shing.wai.chan_at_oracle.com> wrote:
> 
> In this case, I plan to add the following in ServletContext:
> 
>    /**
>     * Gets the session timeout in minutes that are supported by default for
>     * this <tt>ServletContext</tt>.
>     *
>     * @return the session timeout in minutes that are supported by default for
>     * this <tt>ServletContext</tt>
>     *
>     * @throws UnsupportedOperationException if this ServletContext was
>     * passed to the {_at_link ServletContextListener#contextInitialized} method
>     * of a {_at_link ServletContextListener} that was neither declared in
>     * <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated
>     * with {_at_link javax.servlet.annotation.WebListener}
>     *
>     * @since Servlet 4.0
>     */
>    public int getSessionTimeout();
> 
> 
>    /**
>     * Sets the session timeout in minutes for this ServletContext.
>     *
>     * @throws IllegalStateException if this ServletContext has already
>     * been initialized
>     *
>     * @throws UnsupportedOperationException if this ServletContext was
>     * passed to the {_at_link ServletContextListener#contextInitialized} method
>     * of a {_at_link ServletContextListener} that was neither declared in
>     * <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated
>     * with {_at_link javax.servlet.annotation.WebListener}
>     *
>     * @since Servlet 4.0
>     */
>    public void setSessionTimeout(int sessionTimeout);
> 
> 
>    /**
>     * Gets the distributable that are supported by default for this
>     * <tt>ServletContext</tt>.
>     *
>     * @return the distributable that are supported by default for this
>     * <tt>ServletContext</tt>
>     *
>     * @throws UnsupportedOperationException if this ServletContext was
>     * passed to the {_at_link ServletContextListener#contextInitialized} method
>     * of a {_at_link ServletContextListener} that was neither declared in
>     * <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated
>     * with {_at_link javax.servlet.annotation.WebListener}
>     *
>     * @since Servlet 4.0
>     */
>    public boolean isDistributable();
> 
> 
>    /**
>     * Sets the distributable for this ServletContext.
>     *
>     * @throws IllegalStateException if this ServletContext has already
>     * been initialized
>     *
>     * @throws UnsupportedOperationException if this ServletContext was
>     * passed to the {_at_link ServletContextListener#contextInitialized} method
>     * of a {_at_link ServletContextListener} that was neither declared in
>     * <code>web.xml</code> or <code>web-fragment.xml</code>, nor annotated
>     * with {_at_link javax.servlet.annotation.WebListener}
>     *
>     * @since Servlet 4.0
>     */
>    public void setDistributable(boolean distributable);
> 
> 
> Any comments? Please let me know.
> Thanks.
>      Shing Wai Chan
> 
> 
>> On Jan 25, 2017, at 1:35 AM, Mark Thomas <markt_at_apache.org> wrote:
>> 
>> On 24/01/2017 06:04, Shing Wai Chan wrote:
>>> 
>>>> On Jan 23, 2017, at 5:17 PM, Shing Wai Chan <shing.wai.chan_at_oracle.com> wrote:
>>>> 
>>>> I am looking at the issue [1] of missing programmatic configuration API for <session-timeout>.
>>>> Under <session-config>, we have <session-timeout>, <cookie-config>, <tracking-mode>.
>>>> The other two are configurable from programmatic API.
>>>> So I suggest to add the following two API in ServletContext
>>> 
>>> The following are some clarifications:
>>> The sessionTimeout below are in minutes.
>>> 
>>>>  public int getSessionTimeout();
>>>> 
>>>>  public void setSessionTimeout(int sessionTimeout);
>>> 
>>> The #setSessionTimeout method  can only be called before the ServletContext is initialized.
>>> It throws IllegalStateException - if this ServletContext has already been initialized
>> 
>> +1
>> 
>>>> In [1], it also mentioned the missing of programmatic API for <distributable>. I do not plan to add API for this unless there are interesting use cases.
>> 
>> I'm not aware of specific requests for setDistributable(boolean) but
>> given we provide the other setters it seems odd to exclude this one just
>> because we can't think of a use case.
>> 
>> If it was going to be a lot of effort to implement then I would agree it
>> makes sense not to add it but the implementation should be trivial.
>> 
>> I think we should add programmatic API for <distributable>.
>> 
>> Mark
>> 
>> 
>>>> 
>>>> Please let me know your comments.
>>>> Thanks.
>>>> 
>>>> Shing Wai Chan
>>>> 
>>>> [1] https://java.net/jira/browse/SERVLET_SPEC-70
>>>> 
>>> 
>> 
>