You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/10/09 15:50:55 UTC

svn commit: r1707727 - in /tomcat/trunk/java/javax/servlet: ./ http/

Author: markt
Date: Fri Oct  9 13:50:54 2015
New Revision: 1707727

URL: http://svn.apache.org/viewvc?rev=1707727&view=rev
Log:
Servlet 4.0
Default methods for listeners

Modified:
    tomcat/trunk/java/javax/servlet/ServletContextAttributeListener.java
    tomcat/trunk/java/javax/servlet/ServletContextListener.java
    tomcat/trunk/java/javax/servlet/ServletRequestAttributeListener.java
    tomcat/trunk/java/javax/servlet/ServletRequestListener.java
    tomcat/trunk/java/javax/servlet/http/HttpSessionActivationListener.java
    tomcat/trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
    tomcat/trunk/java/javax/servlet/http/HttpSessionBindingListener.java
    tomcat/trunk/java/javax/servlet/http/HttpSessionListener.java

Modified: tomcat/trunk/java/javax/servlet/ServletContextAttributeListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletContextAttributeListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/ServletContextAttributeListener.java (original)
+++ tomcat/trunk/java/javax/servlet/ServletContextAttributeListener.java Fri Oct  9 13:50:54 2015
@@ -32,21 +32,27 @@ public interface ServletContextAttribute
     /**
      * Notification that a new attribute was added to the servlet context.
      * Called after the attribute is added.
+     * The default implementation is a NO-OP.
      * @param scae Information about the new attribute
      */
-    public void attributeAdded(ServletContextAttributeEvent scae);
+    public default void attributeAdded(ServletContextAttributeEvent scae) {
+    }
 
     /**
      * Notification that an existing attribute has been removed from the servlet
      * context. Called after the attribute is removed.
+     * The default implementation is a NO-OP.
      * @param scae Information about the removed attribute
      */
-    public void attributeRemoved(ServletContextAttributeEvent scae);
+    public default void attributeRemoved(ServletContextAttributeEvent scae) {
+    }
 
     /**
      * Notification that an attribute on the servlet context has been replaced.
      * Called after the attribute is replaced.
+     * The default implementation is a NO-OP.
      * @param scae Information about the replaced attribute
      */
-    public void attributeReplaced(ServletContextAttributeEvent scae);
+    public default void attributeReplaced(ServletContextAttributeEvent scae) {
+    }
 }

Modified: tomcat/trunk/java/javax/servlet/ServletContextListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletContextListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/ServletContextListener.java (original)
+++ tomcat/trunk/java/javax/servlet/ServletContextListener.java Fri Oct  9 13:50:54 2015
@@ -34,15 +34,19 @@ public interface ServletContextListener
      ** Notification that the web application initialization process is starting.
      * All ServletContextListeners are notified of context initialization before
      * any filter or servlet in the web application is initialized.
+     * The default implementation is a NO-OP.
      * @param sce Information about the ServletContext that was initialized
      */
-    public void contextInitialized(ServletContextEvent sce);
+    public default void contextInitialized(ServletContextEvent sce) {
+    }
 
     /**
      ** Notification that the servlet context is about to be shut down. All
      * servlets and filters have been destroy()ed before any
      * ServletContextListeners are notified of context destruction.
+     * The default implementation is a NO-OP.
      * @param sce Information about the ServletContext that was destroyed
      */
-    public void contextDestroyed(ServletContextEvent sce);
+    public default void contextDestroyed(ServletContextEvent sce) {
+    }
 }

Modified: tomcat/trunk/java/javax/servlet/ServletRequestAttributeListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletRequestAttributeListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/ServletRequestAttributeListener.java (original)
+++ tomcat/trunk/java/javax/servlet/ServletRequestAttributeListener.java Fri Oct  9 13:50:54 2015
@@ -34,22 +34,28 @@ public interface ServletRequestAttribute
     /**
      * Notification that a new attribute was added to the
      * servlet request. Called after the attribute is added.
+     * The default implementation is a NO-OP.
      * @param srae Information about the new request attribute
      */
-    public void attributeAdded(ServletRequestAttributeEvent srae);
+    public default void attributeAdded(ServletRequestAttributeEvent srae) {
+    }
 
     /**
      * Notification that an existing attribute has been removed from the
      * servlet request. Called after the attribute is removed.
+     * The default implementation is a NO-OP.
      * @param srae Information about the removed request attribute
      */
-    public void attributeRemoved(ServletRequestAttributeEvent srae);
+    public default void attributeRemoved(ServletRequestAttributeEvent srae) {
+    }
 
     /**
      * Notification that an attribute was replaced on the
      * servlet request. Called after the attribute is replaced.
+     * The default implementation is a NO-OP.
      * @param srae Information about the replaced request attribute
      */
-    public void attributeReplaced(ServletRequestAttributeEvent srae);
+    public default void attributeReplaced(ServletRequestAttributeEvent srae) {
+    }
 }
 

Modified: tomcat/trunk/java/javax/servlet/ServletRequestListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/ServletRequestListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/ServletRequestListener.java (original)
+++ tomcat/trunk/java/javax/servlet/ServletRequestListener.java Fri Oct  9 13:50:54 2015
@@ -32,13 +32,17 @@ public interface ServletRequestListener
 
     /**
      * The request is about to go out of scope of the web application.
+     * The default implementation is a NO-OP.
      * @param sre Information about the request
      */
-    public void requestDestroyed (ServletRequestEvent sre);
+    public default void requestDestroyed (ServletRequestEvent sre) {
+    }
 
     /**
      * The request is about to come into scope of the web application.
+     * The default implementation is a NO-OP.
      * @param sre Information about the request
      */
-    public void requestInitialized (ServletRequestEvent sre);
+    public default void requestInitialized (ServletRequestEvent sre) {
+    }
 }

Modified: tomcat/trunk/java/javax/servlet/http/HttpSessionActivationListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpSessionActivationListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/HttpSessionActivationListener.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpSessionActivationListener.java Fri Oct  9 13:50:54 2015
@@ -31,16 +31,20 @@ public interface HttpSessionActivationLi
 
     /**
      * Notification that the session is about to be passivated.
+     * The default implementation is a NO-OP.
      *
      * @param se Information about the session this is about to be passivated
      */
-    public void sessionWillPassivate(HttpSessionEvent se);
+    public default void sessionWillPassivate(HttpSessionEvent se) {
+    }
 
     /**
      * Notification that the session has just been activated.
+     * The default implementation is a NO-OP.
      *
      * @param se Information about the session this has just been activated
      */
-    public void sessionDidActivate(HttpSessionEvent se);
+    public default void sessionDidActivate(HttpSessionEvent se) {
+    }
 }
 

Modified: tomcat/trunk/java/javax/servlet/http/HttpSessionAttributeListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpSessionAttributeListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/HttpSessionAttributeListener.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpSessionAttributeListener.java Fri Oct  9 13:50:54 2015
@@ -29,24 +29,30 @@ public interface HttpSessionAttributeLis
     /**
      * Notification that an attribute has been added to a session. Called after
      * the attribute is added.
+     * The default implementation is a NO-OP.
      *
      * @param se Information about the added attribute
      */
-    public void attributeAdded(HttpSessionBindingEvent se);
+    public default void attributeAdded(HttpSessionBindingEvent se) {
+    }
 
     /**
      * Notification that an attribute has been removed from a session. Called
      * after the attribute is removed.
+     * The default implementation is a NO-OP.
      *
      * @param se Information about the removed attribute
      */
-    public void attributeRemoved(HttpSessionBindingEvent se);
+    public default void attributeRemoved(HttpSessionBindingEvent se) {
+    }
 
     /**
      * Notification that an attribute has been replaced in a session. Called
      * after the attribute is replaced.
+     * The default implementation is a NO-OP.
      *
      * @param se Information about the replaced attribute
      */
-    public void attributeReplaced(HttpSessionBindingEvent se);
+    public default void attributeReplaced(HttpSessionBindingEvent se) {
+    }
 }

Modified: tomcat/trunk/java/javax/servlet/http/HttpSessionBindingListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpSessionBindingListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/HttpSessionBindingListener.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpSessionBindingListener.java Fri Oct  9 13:50:54 2015
@@ -34,20 +34,24 @@ public interface HttpSessionBindingListe
     /**
      * Notifies the object that it is being bound to a session and identifies
      * the session.
+     * The default implementation is a NO-OP.
      *
      * @param event
      *            the event that identifies the session
      * @see #valueUnbound
      */
-    public void valueBound(HttpSessionBindingEvent event);
+    public default void valueBound(HttpSessionBindingEvent event) {
+    }
 
     /**
      * Notifies the object that it is being unbound from a session and
      * identifies the session.
+     * The default implementation is a NO-OP.
      *
      * @param event
      *            the event that identifies the session
      * @see #valueBound
      */
-    public void valueUnbound(HttpSessionBindingEvent event);
+    public default void valueUnbound(HttpSessionBindingEvent event) {
+    }
 }

Modified: tomcat/trunk/java/javax/servlet/http/HttpSessionListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/http/HttpSessionListener.java?rev=1707727&r1=1707726&r2=1707727&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/http/HttpSessionListener.java (original)
+++ tomcat/trunk/java/javax/servlet/http/HttpSessionListener.java Fri Oct  9 13:50:54 2015
@@ -31,18 +31,21 @@ public interface HttpSessionListener ext
 
     /**
      * Notification that a session was created.
+     * The default implementation is a NO-OP.
      *
      * @param se
      *            the notification event
      */
-    public void sessionCreated(HttpSessionEvent se);
+    public default void sessionCreated(HttpSessionEvent se) {
+    }
 
     /**
      * Notification that a session is about to be invalidated.
+     * The default implementation is a NO-OP.
      *
      * @param se
      *            the notification event
      */
-    public void sessionDestroyed(HttpSessionEvent se);
-
+    public default void sessionDestroyed(HttpSessionEvent se) {
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org