jsr369-experts@servlet-spec.java.net

[jsr369-experts] SERVLET_SPEC-142: Use Java SE 8 default methods for listeners

From: Shing Wai Chan <shing.wai.chan_at_oracle.com>
Date: Fri, 02 Oct 2015 16:57:44 -0700

In servlet users email alias, there is a discussion of default methods
for listeners.
The jira issue is SERVLET_SPEC-142: Use Java SE 8 default methods for
listeners.

Here are my investigations:
1. We can add no-op default methods to all of the methods in
         javax.servlet:
             ServletContextAttributeListener, ServletContextListener,
             ServletRequestAttributeListener, ServletRequestListener
         javax.servlet.http:
             HttpSessionActivationListener, HttpSessionAttributeListener,
             HttpSessionBindingListener, HttpSessionListener

2. We will "not" add no-op default method to
javax.servlet.http.HttpSessionIdListener
     as there is only "one" method there.

3. We do not add no-op default methods to javax.servlet.WriteListener,
ReadListener
     as all those methods are important.
     Developers need to take a look whether they need to override them.
     In fact, similar interface in JDK 8,
java.nio.channels.CompletionHandler, does not have default methods.

4. For javax.servlet.AsyncListener, we don't want default #onComplete as
we may need to clean up resources there.
     Similarly, in #onError and #onTimeout.
     Should we leave AsyncListener without default methods for now?

Thanks.
      Shing Wai Chan