diff --git a/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java b/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
index 9ee4d12..8426d66 100644
--- a/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
+++ b/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
@@ -313,15 +313,15 @@
             when( localRepo.length() > 0 ).useOptions(
                     systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
             ),
-//                        CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"),
+//            CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"),
+
+            mavenBundle("org.slf4j", "slf4j-api", "1.7.5"),
+            mavenBundle("org.slf4j", "jcl-over-slf4j", "1.7.5"),
+            mavenBundle("org.slf4j", "log4j-over-slf4j", "1.7.5"),
 
             mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "4.0.0"),
             mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice", "1.0.2"),
 
-            mavenBundle("org.slf4j", "slf4j-api", "1.6.4"),
-            mavenBundle("org.slf4j", "jcl-over-slf4j", "1.6.4"),
-            mavenBundle("org.slf4j", "log4j-over-slf4j", "1.6.4"),
-
             mavenBundle("org.apache.felix", "org.apache.felix.http.api").startLevel(START_LEVEL_SYSTEM_BUNDLES),
             mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api").startLevel(START_LEVEL_SYSTEM_BUNDLES),
             mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY).startLevel(START_LEVEL_SYSTEM_BUNDLES),
diff --git a/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java b/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java
index 936bc9b..5f5d9aa 100644
--- a/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java
+++ b/http/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java
@@ -18,15 +18,20 @@
  */
 package org.apache.felix.http.itest;
 
+import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
 import static javax.servlet.http.HttpServletResponse.SC_OK;
 import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE;
 import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
-import java.net.URL;
+import java.util.Dictionary;
+import java.util.Hashtable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
+import javax.servlet.Servlet;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -42,6 +47,7 @@
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerMethod;
 import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
 
 /**
  * Test cases for all supported event listeners.
@@ -52,6 +58,161 @@
 @ExamReactorStrategy(PerMethod.class)
 public class EventListenerTest extends BaseIntegrationTest
 {
+    private Dictionary<String, Object> getListenerProps()
+    {
+        final Dictionary<String, Object> props = new Hashtable<String, Object>();
+        props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER, "true");
+
+        return props;
+    }
+
+    private Dictionary<String, Object> getServletProps(final String pattern)
+    {
+        final Dictionary<String, Object> props = new Hashtable<String, Object>();
+        props.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, pattern);
+
+        return props;
+    }
+
+    /**
+     * Tests that {@link HttpSessionListener}s are called whenever a session is created or destroyed.
+     */
+    @Test
+    public void testHttpSessionListenerOldWhiteboardOk() throws Exception
+    {
+        final CountDownLatch createdLatch = new CountDownLatch(1);
+        final CountDownLatch destroyedLatch = new CountDownLatch(1);
+
+        HttpSessionListener listener = new HttpSessionListener()
+        {
+            @Override
+            public void sessionDestroyed(HttpSessionEvent se)
+            {
+                destroyedLatch.countDown();
+            }
+
+            @Override
+            public void sessionCreated(HttpSessionEvent se)
+            {
+                createdLatch.countDown();
+            }
+        };
+
+        ServiceRegistration<HttpSessionListener> reg = m_context.registerService(HttpSessionListener.class, listener, null);
+
+        register("/session", new TestServlet()
+        {
+            @Override
+            protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+            {
+                HttpSession session = req.getSession();
+                session.setMaxInactiveInterval(2);
+
+                resp.setStatus(SC_OK);
+                resp.flushBuffer();
+            }
+        });
+
+        try
+        {
+            assertContent(SC_OK, null, createURL("/session"));
+
+            // Session should been created...
+            assertTrue(createdLatch.await(50, TimeUnit.SECONDS));
+
+            assertContent(SC_OK, null, createURL("/session"));
+
+            // Session should timeout automatically...
+            assertTrue(destroyedLatch.await(50, TimeUnit.SECONDS));
+        }
+        finally
+        {
+            reg.unregister();
+        }
+    }
+
+    /**
+     * Tests that {@link HttpSessionAttributeListener}s are called whenever a session attribute is added, changed or removed.
+     */
+    @Test
+    public void testHttpSessionAttributeListenerOldWhiteboardOk() throws Exception
+    {
+        final CountDownLatch addedLatch = new CountDownLatch(1);
+        final CountDownLatch removedLatch = new CountDownLatch(1);
+        final CountDownLatch replacedLatch = new CountDownLatch(1);
+
+        HttpSessionAttributeListener listener = new HttpSessionAttributeListener()
+        {
+            @Override
+            public void attributeAdded(HttpSessionBindingEvent event)
+            {
+                addedLatch.countDown();
+            }
+
+            @Override
+            public void attributeRemoved(HttpSessionBindingEvent event)
+            {
+                removedLatch.countDown();
+            }
+
+            @Override
+            public void attributeReplaced(HttpSessionBindingEvent event)
+            {
+                replacedLatch.countDown();
+            }
+        };
+
+        ServiceRegistration<HttpSessionAttributeListener> reg = m_context.registerService(HttpSessionAttributeListener.class, listener, null);
+
+        register("/session", new TestServlet()
+        {
+            @Override
+            protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+            {
+                try
+                {
+                    HttpSession session = req.getSession();
+
+                    session.setAttribute("foo", "bar");
+
+                    assertTrue(addedLatch.await(5, TimeUnit.SECONDS));
+
+                    session.setAttribute("foo", "qux");
+
+                    assertTrue(replacedLatch.await(5, TimeUnit.SECONDS));
+
+                    session.removeAttribute("foo");
+
+                    assertTrue(removedLatch.await(5, TimeUnit.SECONDS));
+
+                    resp.setStatus(SC_OK);
+                }
+                catch (AssertionError ae)
+                {
+                    resp.sendError(SC_INTERNAL_SERVER_ERROR, ae.getMessage());
+                    throw ae;
+                }
+                catch (InterruptedException e)
+                {
+                    resp.sendError(SC_SERVICE_UNAVAILABLE, e.getMessage());
+                }
+                finally
+                {
+                    resp.flushBuffer();
+                }
+            }
+        });
+
+        try
+        {
+            assertContent(SC_OK, null, createURL("/session"));
+        }
+        finally
+        {
+            reg.unregister();
+        }
+    }
+
     /**
      * Tests that {@link HttpSessionListener}s are called whenever a session is created or destroyed.
      */
@@ -76,29 +237,29 @@
             }
         };
 
-        ServiceRegistration reg = m_context.registerService(HttpSessionListener.class.getName(), listener, null);
-
-        register("/session", new TestServlet()
-        {
-            @Override
-            protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+        ServiceRegistration<HttpSessionListener> reg = m_context.registerService(HttpSessionListener.class, listener, getListenerProps());
+        ServiceRegistration<Servlet> regS = m_context.registerService(Servlet.class,
+            new TestServlet()
             {
-                HttpSession session = req.getSession();
-                session.setMaxInactiveInterval(2);
+                @Override
+                protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+                {
+                    HttpSession session = req.getSession();
+                    session.setMaxInactiveInterval(2);
 
-                resp.setStatus(SC_OK);
-                resp.flushBuffer();
-            }
-        });
+                    resp.setStatus(SC_OK);
+                    resp.flushBuffer();
+                }
+            }, getServletProps("/session"));
 
         try
         {
-            assertContent(SC_OK, null, new URL("http://localhost:8080/session"));
+            assertContent(SC_OK, null, createURL("/session"));
 
             // Session should been created...
             assertTrue(createdLatch.await(50, TimeUnit.SECONDS));
 
-            assertContent(SC_OK, null, new URL("http://localhost:8080/session"));
+            assertContent(SC_OK, null, createURL("/session"));
 
             // Session should timeout automatically...
             assertTrue(destroyedLatch.await(50, TimeUnit.SECONDS));
@@ -106,6 +267,7 @@
         finally
         {
             reg.unregister();
+            regS.unregister();
         }
     }
 
@@ -140,49 +302,94 @@
             }
         };
 
-        ServiceRegistration reg = m_context.registerService(HttpSessionAttributeListener.class.getName(), listener, null);
+        ServiceRegistration<HttpSessionAttributeListener> reg = m_context.registerService(HttpSessionAttributeListener.class, listener, getListenerProps());
 
-        register("/session", new TestServlet()
-        {
-            @Override
-            protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+        ServiceRegistration<Servlet> regS = m_context.registerService(Servlet.class,
+            new TestServlet()
             {
-                try
+                @Override
+                protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
                 {
-                    HttpSession session = req.getSession();
+                    try
+                    {
+                        HttpSession session = req.getSession();
 
-                    session.setAttribute("foo", "bar");
+                        session.setAttribute("foo", "bar");
 
-                    assertTrue(addedLatch.await(5, TimeUnit.SECONDS));
+                        assertTrue(addedLatch.await(5, TimeUnit.SECONDS));
 
-                    session.setAttribute("foo", "qux");
+                        session.setAttribute("foo", "qux");
 
-                    assertTrue(replacedLatch.await(5, TimeUnit.SECONDS));
+                        assertTrue(replacedLatch.await(5, TimeUnit.SECONDS));
 
-                    session.removeAttribute("foo");
+                        session.removeAttribute("foo");
 
-                    assertTrue(removedLatch.await(5, TimeUnit.SECONDS));
+                        assertTrue(removedLatch.await(5, TimeUnit.SECONDS));
 
-                    resp.setStatus(SC_OK);
+                        resp.setStatus(SC_OK);
+                    }
+                    catch (AssertionError ae)
+                    {
+                        resp.sendError(SC_INTERNAL_SERVER_ERROR, ae.getMessage());
+                        throw ae;
+                    }
+                    catch (InterruptedException e)
+                    {
+                        resp.sendError(SC_SERVICE_UNAVAILABLE, e.getMessage());
+                    }
+                    finally
+                    {
+                        resp.flushBuffer();
+                    }
                 }
-                catch (InterruptedException e)
-                {
-                    resp.sendError(SC_SERVICE_UNAVAILABLE, e.getMessage());
-                }
-                finally
-                {
-                    resp.flushBuffer();
-                }
-            }
-        });
+            }, getServletProps("/session"));
 
         try
         {
-            assertContent(SC_OK, null, new URL("http://localhost:8080/session"));
+            assertContent(SC_OK, null, createURL("/session"));
         }
         finally
         {
             reg.unregister();
         }
     }
+
+    /**
+     * Tests {@link ServletContextListener}s
+     */
+    @Test
+    public void testServletContextListener() throws Exception
+    {
+        final CountDownLatch initLatch = new CountDownLatch(1);
+        final CountDownLatch destroyLatch = new CountDownLatch(1);
+
+        final ServletContextListener listener = new ServletContextListener()
+        {
+
+            @Override
+            public void contextInitialized(final ServletContextEvent sce)
+            {
+                initLatch.countDown();
+            }
+
+            @Override
+            public void contextDestroyed(final ServletContextEvent sce)
+            {
+                destroyLatch.countDown();
+            }
+        };
+
+        // register with default context
+        final ServiceRegistration<ServletContextListener> reg = m_context.registerService(ServletContextListener.class, listener, getListenerProps());
+
+        try
+        {
+            assertTrue(initLatch.await(5, TimeUnit.SECONDS));
+        }
+        finally
+        {
+            reg.unregister();
+        }
+        assertTrue(destroyLatch.await(5, TimeUnit.SECONDS));
+    }
 }
