You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ja...@apache.org on 2014/06/25 11:52:06 UTC

svn commit: r1605310 [2/3] - in /felix/sandbox/http-rfc189: api/ api/src/main/java/org/apache/felix/http/api/ base/ base/src/main/java/org/apache/felix/http/base/internal/handler/ base/src/main/java/org/apache/felix/http/base/internal/service/ base/src...

Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java (original)
+++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java Wed Jun 25 09:52:05 2014
@@ -44,14 +44,14 @@ import javax.servlet.http.HttpServletRes
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.http.NamespaceException;
 
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
 public class RequestDispatchTest extends BaseIntegrationTest
 {
     /**
@@ -152,7 +152,7 @@ public class RequestDispatchTest extends
                 {
                     assertEquals("", req.getContextPath());
                     assertEquals("/test", req.getServletPath());
-                    assertEquals("/test/forward", req.getPathInfo()); // XXX ?
+                    assertEquals("/forward", req.getPathInfo());
                     assertEquals("/test/forward", req.getRequestURI());
                     assertEquals("bar=qux&quu", req.getQueryString());
 

Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java (original)
+++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java Wed Jun 25 09:52:05 2014
@@ -35,13 +35,13 @@ import javax.servlet.http.HttpServletRes
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+import org.ops4j.pax.exam.junit.PaxExam;
 import org.osgi.service.http.HttpContext;
 
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
 public class ResourceTest extends BaseIntegrationTest
 {
 

Modified: felix/sandbox/http-rfc189/jetty/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/jetty/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/jetty/pom.xml (original)
+++ felix/sandbox/http-rfc189/jetty/pom.xml Wed Jun 25 09:52:05 2014
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Jetty</name>
     <artifactId>org.apache.felix.http.jetty</artifactId>
-    <version>2.3.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
     
     <scm>
@@ -46,6 +46,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
+				<extensions>true</extensions>
                 <configuration>
                     <instructions>
                     	<X-Jetty-Version>
@@ -87,7 +88,6 @@
         <dependency>
             <groupId>biz.aQute</groupId>
             <artifactId>bndlib</artifactId>
-            <version>1.50.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: felix/sandbox/http-rfc189/parent/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/parent/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/parent/pom.xml (original)
+++ felix/sandbox/http-rfc189/parent/pom.xml Wed Jun 25 09:52:05 2014
@@ -28,7 +28,6 @@
     </parent>
 
     <name>Apache Felix Http Parent POM</name>
-    <groupId>org.apache.felix</groupId>
     <artifactId>org.apache.felix.http.parent</artifactId>
     <version>3-SNAPSHOT</version>
     <packaging>pom</packaging>
@@ -39,13 +38,13 @@
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    	<jetty.version>8.1.14.v20131031</jetty.version>
+    	<jetty.version>8.1.15.v20140411</jetty.version>
     	<cometd.version>2.8.0</cometd.version>
-        <http.service.version>1.2.0</http.service.version>
+        <http.service.version>1.3.0</http.service.version>
         <osgi.dto.version>1.0.0</osgi.dto.version>
     	<servlet.version>3.0.1</servlet.version>
 
-    	<http.api.version>2.0.4</http.api.version>
+    	<http.api.version>3.0.0</http.api.version>
     </properties>
 
     <scm>
@@ -70,7 +69,7 @@
                 <plugin>
                     <groupId>org.apache.felix</groupId>
                     <artifactId>maven-bundle-plugin</artifactId>
-                    <version>2.3.6</version>
+                    <version>2.4.0</version>
                     <executions>
                       <execution>
                         <id>bundle</id>
@@ -126,6 +125,12 @@
                 <version>4.2.0</version>
                 <scope>provided</scope>
             </dependency>
+	        <dependency>
+	            <groupId>biz.aQute</groupId>
+	            <artifactId>bndlib</artifactId>
+	            <version>1.50.0</version>
+	            <scope>provided</scope>
+	        </dependency>
         </dependencies>
     </dependencyManagement>
 </project>

Modified: felix/sandbox/http-rfc189/samples/bridge/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/samples/bridge/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/samples/bridge/pom.xml (original)
+++ felix/sandbox/http-rfc189/samples/bridge/pom.xml Wed Jun 25 09:52:05 2014
@@ -93,7 +93,6 @@
              <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
-                <version>2.0.4</version>
                 <executions>
                     <execution>
                         <id>attach-sources</id>

Modified: felix/sandbox/http-rfc189/samples/cometd/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/samples/cometd/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/samples/cometd/pom.xml (original)
+++ felix/sandbox/http-rfc189/samples/cometd/pom.xml Wed Jun 25 09:52:05 2014
@@ -63,7 +63,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
-                <version>2.0.4</version>
                 <executions>
                     <execution>
                         <id>attach-sources</id>

Modified: felix/sandbox/http-rfc189/samples/filter/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/samples/filter/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/samples/filter/pom.xml (original)
+++ felix/sandbox/http-rfc189/samples/filter/pom.xml Wed Jun 25 09:52:05 2014
@@ -59,7 +59,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
-                <version>2.0.4</version>
                 <executions>
                     <execution>
                         <id>attach-sources</id>

Modified: felix/sandbox/http-rfc189/samples/whiteboard/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/samples/whiteboard/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/samples/whiteboard/pom.xml (original)
+++ felix/sandbox/http-rfc189/samples/whiteboard/pom.xml Wed Jun 25 09:52:05 2014
@@ -59,7 +59,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
-                <version>2.0.4</version>
                 <executions>
                     <execution>
                         <id>attach-sources</id>

Modified: felix/sandbox/http-rfc189/servlet-api/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/servlet-api/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/servlet-api/pom.xml (original)
+++ felix/sandbox/http-rfc189/servlet-api/pom.xml Wed Jun 25 09:52:05 2014
@@ -23,8 +23,8 @@
     <name>Apache Felix Servlet API</name>
     <description>Provides the Servlet API for use by applications</description>
     <artifactId>org.apache.felix.http.servlet-api</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-    <packaging>bundle</packaging>
+    <version>1.0.1-SNAPSHOT</version>
+    <packaging>jar</packaging>
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/servlet-api</connection>

Modified: felix/sandbox/http-rfc189/sslfilter/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/sslfilter/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/sslfilter/pom.xml (original)
+++ felix/sandbox/http-rfc189/sslfilter/pom.xml Wed Jun 25 09:52:05 2014
@@ -29,7 +29,7 @@
     <name>Apache Felix Http SSL Filter</name>
     <artifactId>org.apache.felix.http.sslfilter</artifactId>
     <version>0.1.0-SNAPSHOT</version>
-    <packaging>bundle</packaging>
+    <packaging>jar</packaging>
 
     <scm>
         <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/sslfilter</connection>

Modified: felix/sandbox/http-rfc189/whiteboard/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/pom.xml (original)
+++ felix/sandbox/http-rfc189/whiteboard/pom.xml Wed Jun 25 09:52:05 2014
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Whiteboard</name>
     <artifactId>org.apache.felix.http.whiteboard</artifactId>
-    <version>2.3.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <scm>
@@ -89,7 +89,6 @@
         <dependency>
             <groupId>biz.aQute</groupId>
             <artifactId>bndlib</artifactId>
-            <version>1.50.0</version>
             <scope>provided</scope>
         </dependency>
 

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java Wed Jun 25 09:52:05 2014
@@ -16,23 +16,22 @@
  */
 package org.apache.felix.http.whiteboard.internal;
 
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import org.apache.felix.http.base.internal.AbstractActivator;
+import org.apache.felix.http.base.internal.logger.SystemLogger;
+import org.apache.felix.http.whiteboard.internal.manager.ExtenderManager;
+import org.apache.felix.http.whiteboard.internal.manager.HttpWhiteboardWebConsolePlugin;
 import org.apache.felix.http.whiteboard.internal.tracker.FilterTracker;
 import org.apache.felix.http.whiteboard.internal.tracker.HttpContextTracker;
-import org.apache.felix.http.whiteboard.internal.tracker.HttpServiceRuntimeTracker;
-import org.apache.felix.http.whiteboard.internal.tracker.ServletTracker;
 import org.apache.felix.http.whiteboard.internal.tracker.HttpServiceTracker;
-import org.apache.felix.http.whiteboard.internal.manager.ExtenderManager;
-import org.apache.felix.http.whiteboard.internal.manager.HttpWhiteboardWebConsolePlugin;
-import org.apache.felix.http.base.internal.AbstractActivator;
-import org.apache.felix.http.base.internal.logger.SystemLogger;
-import java.util.ArrayList;
-import java.util.Hashtable;
+import org.apache.felix.http.whiteboard.internal.tracker.ServletTracker;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTracker;
 
-public final class WhiteboardActivator
-    extends AbstractActivator
+public final class WhiteboardActivator extends AbstractActivator
 {
     private final ArrayList<ServiceTracker> trackers;
     private ExtenderManager manager;
@@ -43,22 +42,19 @@ public final class WhiteboardActivator
         this.trackers = new ArrayList<ServiceTracker>();
     }
 
-    protected void doStart()
-        throws Exception
+    protected void doStart() throws Exception
     {
         this.manager = new ExtenderManager();
         addTracker(new HttpContextTracker(getBundleContext(), this.manager));
         addTracker(new FilterTracker(getBundleContext(), this.manager));
         addTracker(new ServletTracker(getBundleContext(), this.manager));
         addTracker(new HttpServiceTracker(getBundleContext(), this.manager));
-        addTracker(new HttpServiceRuntimeTracker(getBundleContext(), this.manager));
 
         HttpWhiteboardWebConsolePlugin plugin = new HttpWhiteboardWebConsolePlugin(this.manager);
         Hashtable<String, Object> props = new Hashtable<String, Object>();
         props.put("felix.webconsole.label", plugin.getLabel());
         props.put("felix.webconsole.title", plugin.getTitle());
-        props.put("felix.webconsole.configprinter.modes", new String[]
-            { "txt", "zip" });
+        props.put("felix.webconsole.configprinter.modes", new String[] { "txt", "zip" });
         props.put(Constants.SERVICE_DESCRIPTION, "Felix Http Whiteboard WebConsole Plugin and Configuration Printer");
         httpPlugin = getBundleContext().registerService("javax.servlet.Servlet", plugin, props);
 
@@ -71,12 +67,12 @@ public final class WhiteboardActivator
         tracker.open();
     }
 
-    protected void doStop()
-        throws Exception
+    protected void doStop() throws Exception
     {
         this.httpPlugin.unregister();
 
-        for (ServiceTracker tracker : this.trackers) {
+        for (ServiceTracker tracker : this.trackers)
+        {
             tracker.close();
         }
 

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/AbstractMapping.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/AbstractMapping.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/AbstractMapping.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/AbstractMapping.java Wed Jun 25 09:52:05 2014
@@ -18,24 +18,23 @@ package org.apache.felix.http.whiteboard
 
 import java.util.Hashtable;
 
-import org.osgi.dto.DTO;
+import javax.servlet.ServletException;
+
 import org.osgi.framework.Bundle;
 import org.osgi.service.http.HttpContext;
 import org.osgi.service.http.HttpService;
-import org.osgi.service.http.runtime.HttpServiceRuntime;
+import org.osgi.service.http.NamespaceException;
 
-abstract class AbstractMapping<T extends DTO>
+abstract class AbstractMapping
 {
     private final Bundle bundle;
-    private final T dto;
     private HttpContext context;
     private final Hashtable<String, String> initParams;
     private boolean registered;
 
-    protected AbstractMapping(final Bundle bundle, final T dto)
+    protected AbstractMapping(Bundle bundle)
     {
         this.bundle = bundle;
-        this.dto = dto;
         this.context = null;
         this.initParams = new Hashtable<String, String>();
         this.registered = false;
@@ -46,11 +45,6 @@ abstract class AbstractMapping<T extends
         return bundle;
     }
 
-    public T getDto()
-    {
-        return dto;
-    }
-
     public void setContext(HttpContext context)
     {
         this.context = context;
@@ -76,8 +70,8 @@ abstract class AbstractMapping<T extends
         this.registered = registered;
     }
 
-    public abstract void register(HttpService httpService, HttpServiceRuntime httpServiceRuntime);
+    public abstract void register(HttpService httpService) throws ServletException, NamespaceException;
 
-    public abstract void unregister(HttpService httpService, HttpServiceRuntime httpServiceRuntime);
+    public abstract void unregister(HttpService httpService) throws ServletException;
 
 }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ErrorPageMapping.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ErrorPageMapping.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ErrorPageMapping.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ErrorPageMapping.java Wed Jun 25 09:52:05 2014
@@ -18,22 +18,23 @@ package org.apache.felix.http.whiteboard
 
 import org.osgi.framework.Bundle;
 import org.osgi.service.http.HttpService;
-import org.osgi.service.http.runtime.HttpServiceRuntime;
-import org.osgi.service.http.runtime.dto.ErrorPageDTO;
 
-public final class ErrorPageMapping extends AbstractMapping<ErrorPageDTO> {
-
-    protected ErrorPageMapping(Bundle bundle, ErrorPageDTO dto) {
-        super(bundle, dto);
+public final class ErrorPageMapping extends AbstractMapping
+{
+    public ErrorPageMapping(Bundle bundle)
+    {
+        super(bundle);
     }
 
     @Override
-    public void register(HttpService httpService, HttpServiceRuntime httpServiceRuntime) {
+    public void register(HttpService httpService)
+    {
         // TODO Auto-generated method stub
     }
 
     @Override
-    public void unregister(HttpService httpService, HttpServiceRuntime httpServiceRuntime) {
+    public void unregister(HttpService httpService)
+    {
         // TODO Auto-generated method stub
     }
 

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ExtenderManager.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ExtenderManager.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ExtenderManager.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ExtenderManager.java Wed Jun 25 09:52:05 2014
@@ -18,49 +18,43 @@ package org.apache.felix.http.whiteboard
 
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
-import java.util.regex.Pattern;
 
 import javax.servlet.Filter;
 import javax.servlet.Servlet;
+import javax.servlet.ServletException;
 
 import org.apache.felix.http.api.ExtHttpService;
+import org.apache.felix.http.api.FilterInfo;
+import org.apache.felix.http.api.ServletInfo;
 import org.apache.felix.http.base.internal.logger.SystemLogger;
-
 import org.apache.felix.http.whiteboard.internal.manager.HttpContextManager.HttpContextHolder;
-import org.osgi.dto.DTO;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpContext;
 import org.osgi.service.http.HttpService;
-import org.osgi.service.http.runtime.HttpServiceRuntime;
-import org.osgi.service.http.runtime.dto.BaseServletDTO;
-import org.osgi.service.http.runtime.dto.ErrorPageDTO;
-import org.osgi.service.http.runtime.dto.FilterDTO;
-import org.osgi.service.http.runtime.dto.ServletDTO;
+import org.osgi.service.http.NamespaceException;
 import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
 
+@SuppressWarnings({ "deprecation" })
 public final class ExtenderManager
 {
-    private HttpService httpService;
-    private HttpServiceRuntime httpServiceRuntime;
-    private final HashMap<ServiceReference, AbstractMapping<? extends DTO>> mapping;
+    private final HashMap<ServiceReference, AbstractMapping> mapping;
     private final HttpContextManager contextManager;
-    private final Pattern statusCodePattern;
+
+    private volatile HttpService httpService;
 
     public ExtenderManager()
     {
-        this.mapping = new HashMap<ServiceReference, AbstractMapping<? extends DTO>>();
+        this.mapping = new HashMap<ServiceReference, AbstractMapping>();
         this.contextManager = new HttpContextManager();
-        this.statusCodePattern = Pattern.compile("\\d{3}");
     }
 
     static boolean isEmpty(final String value)
     {
-        return value == null || value.length() == 0;
+        return value == null || "".equals(value);
     }
 
     static boolean isEmpty(final String[] value)
@@ -71,23 +65,29 @@ public final class ExtenderManager
     private String getStringProperty(ServiceReference ref, String key)
     {
         Object value = ref.getProperty(key);
-        return (value instanceof String) ? (String)value : null;
+        return (value instanceof String) ? (String) value : null;
     }
 
     private String[] getStringArrayProperty(ServiceReference ref, String key)
     {
         Object value = ref.getProperty(key);
 
-        if (value instanceof String) {
-            return new String[]{ (String) value };
-        } else if (value instanceof String[]) {
+        if (value instanceof String)
+        {
+            return new String[] { (String) value };
+        }
+        else if (value instanceof String[])
+        {
             return (String[]) value;
-        } else if (value instanceof Collection<?>) {
+        }
+        else if (value instanceof Collection<?>)
+        {
             Collection<?> collectionValues = (Collection<?>) value;
             String[] values = new String[collectionValues.size()];
 
             int i = 0;
-            for (Object current : collectionValues) {
+            for (Object current : collectionValues)
+            {
                 values[i++] = current != null ? String.valueOf(current) : null;
             }
 
@@ -114,281 +114,247 @@ public final class ExtenderManager
     private int getIntProperty(ServiceReference ref, String key, int defValue)
     {
         Object value = ref.getProperty(key);
-        if (value == null) {
+        if (value == null)
+        {
             return defValue;
         }
 
-        try {
+        try
+        {
             return Integer.parseInt(value.toString());
-        } catch (Exception e) {
+        }
+        catch (Exception e)
+        {
             return defValue;
         }
     }
 
-    private <T extends DTO> void addInitParams(ServiceReference ref, AbstractMapping<T> mapping)
+    private void addInitParams(ServiceReference ref, AbstractMapping mapping)
     {
-        for (String key : ref.getPropertyKeys()) {
+        for (String key : ref.getPropertyKeys())
+        {
             String prefixKey = null;
 
-            if (mapping instanceof FilterMapping && key.startsWith(org.apache.felix.http.whiteboard.HttpWhiteboardConstants.FILTER_INIT_PREFIX)) {
+            if (mapping instanceof FilterMapping && key.startsWith(org.apache.felix.http.whiteboard.HttpWhiteboardConstants.FILTER_INIT_PREFIX))
+            {
                 prefixKey = org.apache.felix.http.whiteboard.HttpWhiteboardConstants.FILTER_INIT_PREFIX;
-            } else if (mapping instanceof ServletMapping && key.startsWith(org.apache.felix.http.whiteboard.HttpWhiteboardConstants.SERVLET_INIT_PREFIX)) {
+            }
+            else if (mapping instanceof ServletMapping && key.startsWith(org.apache.felix.http.whiteboard.HttpWhiteboardConstants.SERVLET_INIT_PREFIX))
+            {
                 prefixKey = org.apache.felix.http.whiteboard.HttpWhiteboardConstants.SERVLET_INIT_PREFIX;
-            } else if (key.startsWith(org.apache.felix.http.whiteboard.HttpWhiteboardConstants.INIT_PREFIX)) {
+            }
+            else if (key.startsWith(org.apache.felix.http.whiteboard.HttpWhiteboardConstants.INIT_PREFIX))
+            {
                 // keep the backward compatibility
                 prefixKey = org.apache.felix.http.whiteboard.HttpWhiteboardConstants.INIT_PREFIX;
             }
 
-            if (prefixKey != null) {
+            if (prefixKey != null)
+            {
                 String paramKey = key.substring(prefixKey.length());
                 String paramValue = getStringProperty(ref, key);
 
-                if (paramValue != null) {
+                if (paramValue != null)
+                {
                     mapping.getInitParams().put(paramKey, paramValue);
                 }
             }
         }
     }
 
-    public void add(HttpContext service, ServiceReference ref)
+    public void add(HttpContext service, ServiceReference ref) throws ServletException, NamespaceException
     {
         String contextId = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.CONTEXT_ID);
         if (!isEmpty(contextId))
         {
             boolean shared = getBooleanProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.CONTEXT_SHARED);
             Bundle bundle = shared ? null : ref.getBundle();
-            Collection<AbstractMapping<? extends DTO>> mappings = this.contextManager.addHttpContext(bundle, contextId, service);
-            for (AbstractMapping<? extends DTO> mapping : mappings)
+            Collection<AbstractMapping> mappings = this.contextManager.addHttpContext(bundle, contextId, service);
+            for (AbstractMapping mapping : mappings)
             {
                 registerMapping(mapping);
             }
         }
         else
         {
-            SystemLogger.debug("Ignoring HttpContext Service "
-                               + ref + ", " + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.CONTEXT_ID
-                               + " is missing or empty");
+            SystemLogger.debug("Ignoring HttpContext Service " + ref + ", " + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.CONTEXT_ID + " is missing or empty");
         }
     }
 
-    public void remove(HttpContext service)
+    public void remove(HttpContext service) throws ServletException
     {
-        Collection<AbstractMapping<? extends DTO>> mappings = this.contextManager.removeHttpContext(service);
+        Collection<AbstractMapping> mappings = this.contextManager.removeHttpContext(service);
         if (mappings != null)
         {
-            for (AbstractMapping<? extends DTO> mapping : mappings)
+            for (AbstractMapping mapping : mappings)
             {
                 unregisterMapping(mapping);
             }
         }
     }
 
-    private <T extends DTO> void getHttpContext(AbstractMapping<T> mapping, ServiceReference ref)
+    private HttpContext getHttpContext(AbstractMapping mapping, ServiceReference ref)
     {
         Bundle bundle = ref.getBundle();
         String contextId = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.CONTEXT_ID);
-        this.contextManager.getHttpContext(bundle, contextId, mapping);
+        return this.contextManager.getHttpContext(bundle, contextId, mapping);
     }
 
-    private <T extends DTO> void ungetHttpContext(AbstractMapping<T> mapping, ServiceReference ref)
+    private void ungetHttpContext(AbstractMapping mapping, ServiceReference ref)
     {
         Bundle bundle = ref.getBundle();
         String contextId = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.CONTEXT_ID);
         this.contextManager.ungetHttpContext(bundle, contextId, mapping);
     }
 
-    public void add(Filter service, ServiceReference ref)
+    public void add(Filter service, ServiceReference ref) throws ServletException, NamespaceException
     {
-        FilterDTO filterDTO = new FilterDTO();
-        filterDTO.serviceId = (Long) ref.getProperty(Constants.SERVICE_ID);
-        filterDTO.asyncSupported = getBooleanProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED);
-        filterDTO.dispatcher = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER);
-        filterDTO.name = getStringProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME);
-        filterDTO.servletNames = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_SERVLET);
-        filterDTO.patterns = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN);
+        FilterInfo filterInfo = new FilterInfo();
+        filterInfo.name = getStringProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_NAME);
+        filterInfo.asyncSupported = getBooleanProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED);
+        filterInfo.dispatcher = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_DISPATCHER);
+        filterInfo.servletNames = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_SERVLET);
+        filterInfo.patterns = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN);
+        filterInfo.ranking = getIntProperty(ref, Constants.SERVICE_RANKING, 0);
 
-        if (isEmpty(filterDTO.patterns)) {
+        if (isEmpty(filterInfo.patterns))
+        {
             // fallback to backward compatible property
             String pattern = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.PATTERN);
 
-            if (isEmpty(pattern)) {
-                SystemLogger.debug("Ignoring Filter Service " + ref + ", " + HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN
-                        + " (or deprecated "
-                        + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.PATTERN
-                        + ") is missing or empty");
-                    return;
+            if (isEmpty(pattern))
+            {
+                SystemLogger.debug("Ignoring Filter Service " + ref + ", " + HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN + " (or deprecated "
+                    + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.PATTERN + ") is missing or empty");
+                return;
             }
 
-            filterDTO.patterns = new String[]{ pattern };
+            filterInfo.patterns = new String[] { pattern };
         }
 
-        int ranking = getIntProperty(ref, Constants.SERVICE_RANKING, 0);
-
-        FilterMapping mapping = new FilterMapping(ref.getBundle(), filterDTO, service, ranking);
-        getHttpContext(mapping, ref);
+        FilterMapping mapping = new FilterMapping(ref.getBundle(), service, filterInfo);
+        filterInfo.context = getHttpContext(mapping, ref); // XXX
         addInitParams(ref, mapping);
         addMapping(ref, mapping);
     }
 
-    public void add(Servlet service, ServiceReference ref)
+    public void add(Servlet service, ServiceReference ref) throws ServletException, NamespaceException
     {
-        AbstractMapping<? extends DTO> mapping;
-        BaseServletDTO baseServletDTO;
+        ServletInfo servletInfo = new ServletInfo();
+        servletInfo.name = getStringProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME);
+        servletInfo.errorPage = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE);
+        servletInfo.patterns = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN);
+        servletInfo.asyncSupported = getBooleanProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED);
+
+        if (isEmpty(servletInfo.patterns))
+        {
+            // fallback to backward compatible property
+            String pattern = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.PATTERN);
 
-        String[] errorPages = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE);
+            if (isEmpty(pattern))
+            {
+                String alias = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.ALIAS);
 
-        if (isEmpty(errorPages)) {
-            ServletDTO servletDTO = new ServletDTO();
-            servletDTO.patterns = getStringArrayProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN);
-
-            if (isEmpty(servletDTO.patterns)) {
-                // fallback to backward compatible property
-                String pattern = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.PATTERN);
-
-                if (isEmpty(pattern)) {
-                    String alias = getStringProperty(ref, org.apache.felix.http.whiteboard.HttpWhiteboardConstants.ALIAS);
-
-                    if (isEmpty(alias))
-                    {
-                        SystemLogger.debug("Ignoring Servlet Service " + ref + ", " + HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN
-                                + " (or deprecated "
-                                + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.PATTERN
-                                + " or deprecated "
-                                + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.ALIAS
-                                + ") is missing or empty");
-                            return;
-                    } else {
-                        servletDTO.patterns = new String[]{ alias };
-                    }
-                } else {
-                    servletDTO.patterns = new String[]{ pattern };
+                if (isEmpty(alias))
+                {
+                    SystemLogger.debug("Ignoring Servlet Service " + ref + ", " + HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN + " (or deprecated "
+                        + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.PATTERN + " or deprecated " + org.apache.felix.http.whiteboard.HttpWhiteboardConstants.ALIAS
+                        + ") is missing or empty");
+                    return;
                 }
-            }
-
-            baseServletDTO = servletDTO;
-            mapping = new ServletMapping(ref.getBundle(), servletDTO, service);
-        } else {
-            ErrorPageDTO errorPagesDTO = new ErrorPageDTO();
-            Collection<Long> errorCodes = new LinkedList<Long>();
-            Collection<String> exceptions = new LinkedList<String>();
-
-            for (String errorPage : errorPages) {
-                if (statusCodePattern.matcher(errorPage).matches()) {
-                    errorCodes.add(Long.valueOf(errorPage));
-                } else {
-                    exceptions.add(errorPage);
+                else
+                {
+                    servletInfo.patterns = new String[] { alias };
                 }
             }
-
-            errorPagesDTO.errorCodes = new long[errorCodes.size()];
-            int i = 0;
-            for (Long errorCode : errorCodes) {
-                errorPagesDTO.errorCodes[i++] = errorCode.longValue();
+            else
+            {
+                servletInfo.patterns = new String[] { pattern };
             }
-
-            errorPagesDTO.exceptions = exceptions.toArray(new String[exceptions.size()]);
-
-            baseServletDTO = errorPagesDTO;
-
-            mapping = new ErrorPageMapping(ref.getBundle(), errorPagesDTO);
         }
 
-        baseServletDTO.serviceId = (Long) ref.getProperty(Constants.SERVICE_ID);
-        baseServletDTO.name = getStringProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME);
-        baseServletDTO.asyncSupported = getBooleanProperty(ref, HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED);
-
-        getHttpContext(mapping, ref);
+        ServletMapping mapping = new ServletMapping(ref.getBundle(), service, servletInfo);
+        servletInfo.context = getHttpContext(mapping, ref); // XXX
         addInitParams(ref, mapping);
         addMapping(ref, mapping);
     }
 
-    public void remove(ServiceReference ref)
+    public void remove(ServiceReference ref) throws ServletException
     {
         removeMapping(ref);
     }
 
-    public synchronized void setHttpService(HttpService service)
+    public synchronized void setHttpService(HttpService service) throws ServletException, NamespaceException
     {
         this.httpService = service;
-        if (this.httpService instanceof ExtHttpService) {
+        if (this.httpService instanceof ExtHttpService)
+        {
             SystemLogger.info("Detected extended HttpService. Filters enabled.");
-        } else {
-            SystemLogger.info("Detected standard HttpService. Filters disabled.");
         }
-
-        registerAll();
-    }
-
-    public synchronized void setHttpServiceRuntime(HttpServiceRuntime runtime)
-    {
-        this.httpServiceRuntime = runtime;
-        if (this.httpService instanceof ExtHttpService) {
-            SystemLogger.info("Detected extended HttpServiceRuntime. DTOs registration enabled.");
-        } else {
-            SystemLogger.info("Detected standard HttpServiceRuntime. DTOs registration disabled.");
+        else
+        {
+            SystemLogger.info("Detected standard HttpService. Filters disabled.");
         }
-
         registerAll();
     }
 
-    public synchronized void unsetHttpService()
+    public synchronized void unsetHttpService() throws ServletException
     {
         unregisterAll();
         this.httpService = null;
     }
 
-    public synchronized void unsetHttpServiceRuntime()
+    public synchronized void unregisterAll() throws ServletException
     {
-        this.httpServiceRuntime = null;
+        Collection<AbstractMapping> mappings = null;
+        HttpService service;
+        synchronized (this)
+        {
+            service = this.httpService;
+            if (service != null)
+            {
+                mappings = this.mapping.values();
+            }
+        }
+        if (mappings != null)
+        {
+            for (AbstractMapping mapping : mappings)
+            {
+                mapping.unregister(service);
+            }
+        }
     }
 
-    public synchronized void unregisterAll()
+    private synchronized void registerAll() throws ServletException, NamespaceException
     {
-    	Collection<AbstractMapping<? extends DTO>> mappings = null;
-    	HttpService service;
-    	HttpServiceRuntime runtime;
-    	synchronized (this) {
-			service = this.httpService;
-			if (service != null) {
-				mappings = this.mapping.values();
-    		}
-			runtime = this.httpServiceRuntime;
-    	}
-    	if (mappings != null) {
-    		for (AbstractMapping<? extends DTO> mapping : mappings) {
-    			mapping.unregister(service, runtime);
-    		}
-    	}
-    }
-
-    private synchronized void registerAll()
-    {
-    	Collection<AbstractMapping<? extends DTO>> mappings = null;
-    	HttpService service;
-        HttpServiceRuntime runtime;
-    	synchronized (this) {
-			service = this.httpService;
-			if (service != null) {
-				mappings = this.mapping.values();
-    		}
-            runtime = this.httpServiceRuntime;
-    	}
-    	if (mappings != null) {
-    		for (AbstractMapping<? extends DTO> mapping : mappings) {
-    			mapping.register(service, runtime);
-    		}
-    	}
+        Collection<AbstractMapping> mappings = null;
+        HttpService service;
+        synchronized (this)
+        {
+            service = this.httpService;
+            if (service != null)
+            {
+                mappings = this.mapping.values();
+            }
+        }
+        if (mappings != null)
+        {
+            for (AbstractMapping mapping : mappings)
+            {
+                mapping.register(service);
+            }
+        }
     }
 
-    private synchronized <T extends DTO> void addMapping(ServiceReference ref, AbstractMapping<T> mapping)
+    private synchronized void addMapping(ServiceReference ref, AbstractMapping mapping) throws ServletException, NamespaceException
     {
         this.mapping.put(ref, mapping);
-        this.registerMapping(mapping);
+        registerMapping(mapping);
     }
 
-    private synchronized void removeMapping(ServiceReference ref)
+    private synchronized void removeMapping(ServiceReference ref) throws ServletException
     {
-        AbstractMapping<? extends DTO> mapping = this.mapping.remove(ref);
+        AbstractMapping mapping = this.mapping.remove(ref);
         if (mapping != null)
         {
             ungetHttpContext(mapping, ref);
@@ -396,23 +362,21 @@ public final class ExtenderManager
         }
     }
 
-    private <T extends DTO> void registerMapping(AbstractMapping<T> mapping)
+    private void registerMapping(AbstractMapping mapping) throws ServletException, NamespaceException
     {
         HttpService httpService = this.httpService;
-        HttpServiceRuntime httpServiceRuntime = this.httpServiceRuntime;
-        if (httpService != null && httpServiceRuntime != null)
+        if (httpService != null)
         {
-            mapping.register(httpService, httpServiceRuntime);
+            mapping.register(httpService);
         }
     }
 
-    private <T extends DTO> void unregisterMapping(AbstractMapping<T> mapping)
+    private void unregisterMapping(AbstractMapping mapping) throws ServletException
     {
         HttpService httpService = this.httpService;
-        HttpServiceRuntime httpServiceRuntime = this.httpServiceRuntime;
-        if (httpService != null && httpServiceRuntime != null)
+        if (httpService != null)
         {
-            mapping.unregister(httpService, httpServiceRuntime);
+            mapping.unregister(httpService);
         }
     }
 
@@ -432,7 +396,7 @@ public final class ExtenderManager
      * Returns {@link AbstractMapping} instances for which there is no
      * registered HttpContext as desired by the context ID.
      */
-    Map<String, Set<AbstractMapping<? extends DTO>>> getOrphanMappings()
+    Map<String, Set<AbstractMapping>> getOrphanMappings()
     {
         return this.contextManager.getOrphanMappings();
     }
@@ -440,11 +404,11 @@ public final class ExtenderManager
     /**
      * Returns mappings indexed by there owning OSGi service.
      */
-    Map<Object, AbstractMapping<? extends DTO>> getMappings()
+    Map<Object, AbstractMapping> getMappings()
     {
         synchronized (this)
         {
-            return new HashMap<Object, AbstractMapping<? extends DTO>>(this.mapping);
+            return new HashMap<Object, AbstractMapping>(this.mapping);
         }
     }
 }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/FilterMapping.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/FilterMapping.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/FilterMapping.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/FilterMapping.java Wed Jun 25 09:52:05 2014
@@ -17,90 +17,58 @@
 package org.apache.felix.http.whiteboard.internal.manager;
 
 import javax.servlet.Filter;
+import javax.servlet.ServletException;
 
 import org.apache.felix.http.api.ExtHttpService;
-import org.apache.felix.http.api.ExtHttpServiceRuntime;
-import org.apache.felix.http.base.internal.logger.SystemLogger;
+import org.apache.felix.http.api.FilterInfo;
 import org.osgi.framework.Bundle;
 import org.osgi.service.http.HttpService;
-import org.osgi.service.http.runtime.HttpServiceRuntime;
-import org.osgi.service.http.runtime.dto.FilterDTO;
 
-public final class FilterMapping
-    extends AbstractMapping<FilterDTO>
+public final class FilterMapping extends AbstractMapping
 {
     private final Filter filter;
-    private final int ranking;
+    private final FilterInfo filterInfo;
 
-    public FilterMapping(Bundle bundle, FilterDTO dto, Filter filter, int ranking)
+    public FilterMapping(Bundle bundle, Filter filter, FilterInfo filterInfo)
     {
-        super(bundle, dto);
+        super(bundle);
         this.filter = filter;
-        this.ranking = ranking;
+        this.filterInfo = filterInfo;
     }
 
-    Filter getFilter()
+    @Override
+    public void register(HttpService httpService) throws ServletException
     {
-        return filter;
-    }
-
-    int getRanking()
-    {
-        return ranking;
+        if (!isRegistered() && (httpService instanceof ExtHttpService) && getContext() != null)
+        {
+            register((ExtHttpService) httpService);
+        }
     }
 
-    public void register(HttpService httpService, HttpServiceRuntime httpServiceRuntime)
+    @Override
+    public void unregister(HttpService httpService) throws ServletException
     {
-       if (httpService instanceof ExtHttpService && httpServiceRuntime instanceof ExtHttpServiceRuntime) {
-            register((ExtHttpService) httpService, (ExtHttpServiceRuntime) httpServiceRuntime);
+        if (isRegistered() && (httpService instanceof ExtHttpService))
+        {
+            unregister((ExtHttpService) httpService);
         }
     }
 
-    private void register(ExtHttpService httpService, ExtHttpServiceRuntime httpServiceRuntime)
+    Filter getFilter()
     {
-        if (!this.isRegistered() && getContext() != null)
-        {
-            if (getDto().patterns != null && getDto().patterns.length > 0)
-            {
-                for (String pattern : getDto().patterns)
-                {
-                    try
-                    {
-                        httpService.registerFilter(this.filter, pattern, getInitParams(), ranking, getContext());
-
-                        FilterDTO filterDTO = new FilterDTO();
-                        filterDTO.asyncSupported = getDto().asyncSupported;
-                        filterDTO.dispatcher = getDto().dispatcher;
-                        filterDTO.initParams = getDto().initParams;
-                        filterDTO.patterns = new String[]{ pattern };
-                        filterDTO.serviceId = getDto().serviceId;
-                        filterDTO.servletContextId = getDto().servletContextId;
-                        filterDTO.servletNames = getDto().servletNames;
-                        httpServiceRuntime.registerFilter(filterDTO);
-                    }
-                    catch (Throwable t)
-                    {
-                        SystemLogger.error("Failed to register filter", t);
-                    }
-                }
-                setRegistered(true);
-            }
-        }
+        return filter;
     }
 
-    public void unregister(HttpService httpService, HttpServiceRuntime httpServiceRuntime)
+    private void register(ExtHttpService httpService) throws ServletException
     {
-        if (httpService instanceof ExtHttpService
-                && httpServiceRuntime instanceof ExtHttpServiceRuntime
-                && this.isRegistered())
-        {
-            unregister((ExtHttpService) httpService, (ExtHttpServiceRuntime) httpServiceRuntime);
-            setRegistered(false);
-        }
+        this.filterInfo.context = getContext(); // XXX
+        httpService.registerFilter(this.filter, this.filterInfo);
+        setRegistered(true);
     }
 
-    private void unregister(ExtHttpService httpService, ExtHttpServiceRuntime httpServiceRuntime)
+    private void unregister(ExtHttpService httpService)
     {
         httpService.unregisterFilter(this.filter);
+        setRegistered(false);
     }
 }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpContextManager.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpContextManager.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpContextManager.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpContextManager.java Wed Jun 25 09:52:05 2014
@@ -16,11 +16,6 @@
  */
 package org.apache.felix.http.whiteboard.internal.manager;
 
-import org.osgi.dto.DTO;
-import org.osgi.framework.Bundle;
-import org.osgi.service.http.HttpContext;
-import org.apache.felix.http.base.internal.logger.SystemLogger;
-
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -28,6 +23,10 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.felix.http.base.internal.logger.SystemLogger;
+import org.osgi.framework.Bundle;
+import org.osgi.service.http.HttpContext;
+
 public final class HttpContextManager
 {
     /**
@@ -51,13 +50,13 @@ public final class HttpContextManager
      * Map of servlets and filters registered referring to unregistered
      * contexts as of yet.
      */
-    private final HashMap<String, Set<AbstractMapping<? extends DTO>>> orphanMappings;
+    private final HashMap<String, Set<AbstractMapping>> orphanMappings;
 
     public HttpContextManager()
     {
         this.idMap = new HashMap<String, HttpContextHolder>();
         this.contextMap = new HashMap<HttpContext, String>();
-        this.orphanMappings = new HashMap<String, Set<AbstractMapping<? extends DTO>>>();
+        this.orphanMappings = new HashMap<String, Set<AbstractMapping>>();
     }
 
     private static String createId(Bundle bundle, String contextId)
@@ -81,7 +80,7 @@ public final class HttpContextManager
         return (dash < 0) ? id : id.substring(dash + 1);
     }
 
-    public synchronized <T extends DTO> HttpContext getHttpContext(Bundle bundle, String contextId, AbstractMapping<T> mapping)
+    public synchronized HttpContext getHttpContext(Bundle bundle, String contextId, AbstractMapping mapping)
     {
         // per-bundle context
         String id = createId(bundle, contextId);
@@ -105,10 +104,10 @@ public final class HttpContextManager
             }
 
             // otherwise context is not here yet
-            Set<AbstractMapping<? extends DTO>> orphaned = this.orphanMappings.get(contextId);
+            Set<AbstractMapping> orphaned = this.orphanMappings.get(contextId);
             if (orphaned == null)
             {
-                orphaned = new HashSet<AbstractMapping<? extends DTO>>();
+                orphaned = new HashSet<AbstractMapping>();
                 this.orphanMappings.put(contextId, orphaned);
             }
             if (contextId != null)
@@ -131,7 +130,7 @@ public final class HttpContextManager
         return holder.getContext();
     }
 
-    public synchronized <T extends DTO> void ungetHttpContext(Bundle bundle, String contextId, AbstractMapping<T> mapping)
+    public synchronized void ungetHttpContext(Bundle bundle, String contextId, AbstractMapping mapping)
     {
         // per-bundle context
         String id = createId(bundle, contextId);
@@ -151,7 +150,7 @@ public final class HttpContextManager
         }
         else
         {
-            Set<AbstractMapping<? extends DTO>> orphans = this.orphanMappings.get(contextId);
+            Set<AbstractMapping> orphans = this.orphanMappings.get(contextId);
             if (orphans != null)
             {
                 orphans.remove(mapping);
@@ -166,17 +165,17 @@ public final class HttpContextManager
         }
     }
 
-    public synchronized Collection<AbstractMapping<? extends DTO>> addHttpContext(Bundle bundle, String contextId, HttpContext context)
+    public synchronized Collection<AbstractMapping> addHttpContext(Bundle bundle, String contextId, HttpContext context)
     {
         String id = createId(bundle, contextId);
         HttpContextHolder holder = new HttpContextHolder(context);
 
-        Set<AbstractMapping<? extends DTO>> orphans = this.orphanMappings.remove(contextId);
+        Set<AbstractMapping> orphans = this.orphanMappings.remove(contextId);
         if (orphans != null)
         {
-            for (Iterator<AbstractMapping<? extends DTO>> mi = orphans.iterator(); mi.hasNext();)
+            for (Iterator<AbstractMapping> mi = orphans.iterator(); mi.hasNext();)
             {
-                AbstractMapping<? extends DTO> mapping = mi.next();
+                AbstractMapping mapping = mi.next();
                 if (bundle == null || bundle.equals(mapping.getBundle()))
                 {
                     holder.addMapping(mapping);
@@ -197,7 +196,7 @@ public final class HttpContextManager
         return holder.getMappings();
     }
 
-    public synchronized Collection<AbstractMapping<? extends DTO>> removeHttpContext(HttpContext context)
+    public synchronized Collection<AbstractMapping> removeHttpContext(HttpContext context)
     {
         String id = this.contextMap.remove(context);
         if (id != null)
@@ -205,19 +204,19 @@ public final class HttpContextManager
             HttpContextHolder holder = this.idMap.remove(id);
             if (holder != null)
             {
-                Set<AbstractMapping<? extends DTO>> mappings = holder.getMappings();
+                Set<AbstractMapping> mappings = holder.getMappings();
                 if (mappings != null && !mappings.isEmpty())
                 {
                     // keep the orphans around
                     final String contextId = getContextId(id);
-                    Set<AbstractMapping<? extends DTO>> orphans = this.orphanMappings.get(contextId);
+                    Set<AbstractMapping> orphans = this.orphanMappings.get(contextId);
                     if (orphans == null)
                     {
-                        orphans = new HashSet<AbstractMapping<? extends DTO>>();
+                        orphans = new HashSet<AbstractMapping>();
                         this.orphanMappings.put(getContextId(id), orphans);
                     }
 
-                    for (AbstractMapping<? extends DTO> mapping : mappings)
+                    for (AbstractMapping mapping : mappings)
                     {
                         mapping.setContext(null);
                         orphans.add(mapping);
@@ -234,20 +233,20 @@ public final class HttpContextManager
         return new HashMap<String, HttpContextHolder>(this.idMap);
     }
 
-    synchronized Map<String, Set<AbstractMapping<? extends DTO>>> getOrphanMappings()
+    synchronized Map<String, Set<AbstractMapping>> getOrphanMappings()
     {
-        return new HashMap<String, Set<AbstractMapping<? extends DTO>>>(this.orphanMappings);
+        return new HashMap<String, Set<AbstractMapping>>(this.orphanMappings);
     }
 
     static class HttpContextHolder
     {
         private final HttpContext context;
-        private final Set<AbstractMapping<? extends DTO>> mappings;
+        private final Set<AbstractMapping> mappings;
 
         HttpContextHolder(final HttpContext context)
         {
             this.context = context;
-            this.mappings = new HashSet<AbstractMapping<? extends DTO>>();
+            this.mappings = new HashSet<AbstractMapping>();
         }
 
         public HttpContext getContext()
@@ -255,19 +254,19 @@ public final class HttpContextManager
             return context;
         }
 
-        <T extends DTO> void addMapping(AbstractMapping<T> mapping)
+        void addMapping(AbstractMapping mapping)
         {
             this.mappings.add(mapping);
-            mapping.setContext(this.getContext());
+            mapping.setContext(getContext());
         }
 
-        <T extends DTO> void removeMapping(AbstractMapping<T> mapping)
+        void removeMapping(AbstractMapping mapping)
         {
             mapping.setContext(null);
             this.mappings.remove(mapping);
         }
 
-        public Set<AbstractMapping<? extends DTO>> getMappings()
+        public Set<AbstractMapping> getMappings()
         {
             return mappings;
         }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java Wed Jun 25 09:52:05 2014
@@ -20,10 +20,9 @@ package org.apache.felix.http.whiteboard
 
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.Comparator;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
@@ -34,7 +33,6 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.felix.http.whiteboard.internal.manager.HttpContextManager.HttpContextHolder;
-import org.osgi.dto.DTO;
 
 @SuppressWarnings("serial")
 public class HttpWhiteboardWebConsolePlugin extends HttpServlet
@@ -127,7 +125,7 @@ public class HttpWhiteboardWebConsolePlu
         for (ServletMapping sm : mappings.values())
         {
             pw.println("<tr class='content'>");
-            pw.println("<td class='content'>" + Arrays.toString(sm.getDto().patterns) + "</td>");
+            //            pw.println("<td class='content'>" + Arrays.toString(sm.getDto().patterns) + "</td>"); XXX
             pw.println("<td class='content'>" + sm.getServlet() + "</td>");
             pw.println("<td class='content'>" + sm.getInitParams() + "</td>");
             pw.println("<td class='content'>" + sm.getContext() + "</td>");
@@ -150,15 +148,15 @@ public class HttpWhiteboardWebConsolePlu
         for (FilterMapping fm : mappings)
         {
             pw.println("<tr class='content'>");
-            pw.println("<td class='content'>" + Arrays.toString(fm.getDto().patterns) + "</td>");
-            pw.println("<td class='content'>" + fm.getFilter() + " (" + fm.getRanking() + ")</td>");
+            //            pw.println("<td class='content'>" + Arrays.toString(fm.getDto().patterns) + "</td>"); XXX
+            //            pw.println("<td class='content'>" + fm.getFilter() + " (" + fm.getRanking() + ")</td>"); XXX
             pw.println("<td class='content'>" + fm.getInitParams() + "</td>");
             pw.println("<td class='content'>" + fm.getContext() + "</td>");
             pw.println("</tr>");
         }
     }
 
-    private void printOrphanMappings(PrintWriter pw, Map<String, Set<AbstractMapping<? extends DTO>>> mappings)
+    private void printOrphanMappings(PrintWriter pw, Map<String, Set<AbstractMapping>> mappings)
     {
         pw.println("<tr>");
         pw.println("<th class='content container' colspan='4'>Orphan Servlets and Filters</td>");
@@ -177,24 +175,22 @@ public class HttpWhiteboardWebConsolePlu
             pw.println("<th class='content' colspan='3'>Servlets and Filters</td>");
             pw.println("</tr>");
 
-            for (Entry<String, Set<AbstractMapping<? extends DTO>>> entry : mappings.entrySet())
+            for (Entry<String, Set<AbstractMapping>> entry : mappings.entrySet())
             {
                 pw.println("<tr class='content'>");
                 pw.println("<td class='content'>" + entry.getKey() + "</td>");
                 pw.println("<td class='content' colspan='3'>");
-                for (AbstractMapping<? extends DTO> mapping : entry.getValue())
+                for (AbstractMapping mapping : entry.getValue())
                 {
                     if (mapping instanceof ServletMapping)
                     {
                         ServletMapping servletMapping = (ServletMapping) mapping;
-                        pw.printf("Servlet %s (%s)", Arrays.toString(servletMapping.getDto().patterns),
-                            servletMapping.getServlet());
+//                        pw.printf("Servlet %s (%s)", Arrays.toString(servletMapping.getDto().patterns), servletMapping.getServlet()); XXX
                     }
                     else if (mapping instanceof FilterMapping)
                     {
                         FilterMapping filterMapping = (FilterMapping) mapping;
-                        pw.printf("Filter %s (%s)", Arrays.toString(filterMapping.getDto().patterns),
-                            filterMapping.getFilter());
+//                        pw.printf("Filter %s (%s)", Arrays.toString(filterMapping.getDto().patterns), filterMapping.getFilter()); XXX
                     }
                     pw.println("<br/>");
                 }
@@ -228,8 +224,7 @@ public class HttpWhiteboardWebConsolePlu
         pw.println("Registered Servlet Services");
         for (ServletMapping sm : mappings.values())
         {
-            pw.printf("  %s ==> %s (%s, %s, %s)%n", Arrays.toString(sm.getDto().patterns), sm.getServlet(), sm.isRegistered() ? "registered"
-                : "unregistered", sm.getInitParams(), sm.getContext());
+//            pw.printf("  %s ==> %s (%s, %s, %s)%n", Arrays.toString(sm.getDto().patterns), sm.getServlet(), sm.isRegistered() ? "registered" : "unregistered", sm.getInitParams(), sm.getContext()); XXX
         }
         pw.println();
     }
@@ -239,13 +234,12 @@ public class HttpWhiteboardWebConsolePlu
         pw.println("Registered Filter Services");
         for (FilterMapping fm : mappings)
         {
-            pw.printf("  %s ==> %s (%s, %s, %s, %s)%n", Arrays.toString(fm.getDto().patterns), fm.getFilter(),
-                fm.isRegistered() ? "registered" : "unregistered", fm.getRanking(), fm.getInitParams(), fm.getContext());
+//            pw.printf("  %s ==> %s (%s, %s, %s, %s)%n", Arrays.toString(fm.getDto().patterns), fm.getFilter(), fm.isRegistered() ? "registered" : "unregistered", fm.getRanking(), fm.getInitParams(), fm.getContext()); XXX
         }
         pw.println();
     }
 
-    private void printOrphanMappingsTxt(PrintWriter pw, Map<String, Set<AbstractMapping<? extends DTO>>> mappings)
+    private void printOrphanMappingsTxt(PrintWriter pw, Map<String, Set<AbstractMapping>> mappings)
     {
         pw.println("Orphan Servlets and Filters");
         if (mappings.isEmpty())
@@ -255,11 +249,11 @@ public class HttpWhiteboardWebConsolePlu
         else
         {
 
-            for (Entry<String, Set<AbstractMapping<? extends DTO>>> entry : mappings.entrySet())
+            for (Entry<String, Set<AbstractMapping>> entry : mappings.entrySet())
             {
                 pw.printf("  %s ==> { ", entry.getKey());
                 boolean cont = false;
-                for (AbstractMapping<? extends DTO> mapping : entry.getValue())
+                for (AbstractMapping mapping : entry.getValue())
                 {
                     if (cont)
                     {
@@ -273,14 +267,12 @@ public class HttpWhiteboardWebConsolePlu
                     if (mapping instanceof ServletMapping)
                     {
                         ServletMapping servletMapping = (ServletMapping) mapping;
-                        pw.printf("Servlet %s (%s)", Arrays.toString(servletMapping.getDto().patterns),
-                            servletMapping.getServlet());
+//                        pw.printf("Servlet %s (%s)", Arrays.toString(servletMapping.getDto().patterns), servletMapping.getServlet()); XXX
                     }
                     else if (mapping instanceof FilterMapping)
                     {
                         FilterMapping filterMapping = (FilterMapping) mapping;
-                        pw.printf("Filter %s (%s)", Arrays.toString(filterMapping.getDto().patterns),
-                            filterMapping.getFilter());
+//                        pw.printf("Filter %s (%s)", Arrays.toString(filterMapping.getDto().patterns), filterMapping.getFilter()); XXX
                     }
                 }
                 pw.println(" }");
@@ -296,14 +288,15 @@ public class HttpWhiteboardWebConsolePlu
     private Map<String, ServletMapping> getServlets()
     {
         Map<String, ServletMapping> mappings = new TreeMap<String, ServletMapping>();
-        for (AbstractMapping<? extends DTO> mapping : this.extMgr.getMappings().values())
+        for (AbstractMapping mapping : this.extMgr.getMappings().values())
         {
             if (mapping instanceof ServletMapping)
             {
                 ServletMapping servletMapping = (ServletMapping) mapping;
-                for (String pattern : servletMapping.getDto().patterns) {
-                    mappings.put(pattern, (ServletMapping) mapping);
-                }
+//                for (String pattern : servletMapping.getDto().patterns) XXX
+//                {
+//                    mappings.put(pattern, (ServletMapping) mapping);
+//                }
             }
         }
         return mappings;
@@ -320,28 +313,27 @@ public class HttpWhiteboardWebConsolePlu
                     return 0;
                 }
                 // TODO improve how to compare string arrays!
-                int res = Arrays.equals(o1.getDto().patterns, o2.getDto().patterns)
-                          ? 0
-                          : toIntegerPatternLength(o1).compareTo(toIntegerPatternLength(o2));
-                if (res == 0)
-                {
-                    if (o1.getRanking() > o2.getRanking())
-                    {
-                        res = -1;
-                    }
-                    else if (o1.getRanking() < o2.getRanking())
-                    {
-                        res = 1;
-                    }
-                    else
-                    {
-                        res = o1.getFilter().toString().compareTo(o2.getFilter().toString());
-                    }
-                }
-                return res;
+//                int res = Arrays.equals(o1.getDto().patterns, o2.getDto().patterns) ? 0 : toIntegerPatternLength(o1).compareTo(toIntegerPatternLength(o2));
+//                if (res == 0)
+//                {
+//                    if (o1.getRanking() > o2.getRanking())
+//                    {
+//                        res = -1;
+//                    }
+//                    else if (o1.getRanking() < o2.getRanking())
+//                    {
+//                        res = 1;
+//                    }
+//                    else
+//                    {
+//                        res = o1.getFilter().toString().compareTo(o2.getFilter().toString());
+//                    }
+//                }
+//                return res;
+                return 0; // XXX
             }
         });
-        for (AbstractMapping<? extends DTO> mapping : this.extMgr.getMappings().values())
+        for (AbstractMapping mapping : this.extMgr.getMappings().values())
         {
             if (mapping instanceof FilterMapping)
             {
@@ -353,11 +345,12 @@ public class HttpWhiteboardWebConsolePlu
 
     private static Integer toIntegerPatternLength(FilterMapping filterMapping)
     {
-        return Integer.valueOf(filterMapping.getDto().patterns.length);
+//        return Integer.valueOf(filterMapping.getDto().patterns.length);
+        return Integer.valueOf(0); // XXX
     }
 
-    private Map<String, Set<AbstractMapping<? extends DTO>>> getOrphanMappings()
+    private Map<String, Set<AbstractMapping>> getOrphanMappings()
     {
-        return new TreeMap<String, Set<AbstractMapping<? extends DTO>>>(this.extMgr.getOrphanMappings());
+        return new TreeMap<String, Set<AbstractMapping>>(this.extMgr.getOrphanMappings());
     }
 }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ResourceMapping.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ResourceMapping.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ResourceMapping.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ResourceMapping.java Wed Jun 25 09:52:05 2014
@@ -18,25 +18,22 @@ package org.apache.felix.http.whiteboard
 
 import org.osgi.framework.Bundle;
 import org.osgi.service.http.HttpService;
-import org.osgi.service.http.runtime.HttpServiceRuntime;
-import org.osgi.service.http.runtime.dto.ResourceDTO;
 
-public final class ResourceMapping extends AbstractMapping<ResourceDTO>
+public final class ResourceMapping extends AbstractMapping
 {
-
-    public ResourceMapping(Bundle bundle, ResourceDTO dto)
+    public ResourceMapping(Bundle bundle)
     {
-        super(bundle, dto);
+        super(bundle);
     }
 
     @Override
-    public void register(HttpService httpService, HttpServiceRuntime httpServiceRuntime)
+    public void register(HttpService httpService)
     {
         // TODO Auto-generated method stub
     }
 
     @Override
-    public void unregister(HttpService httpService, HttpServiceRuntime httpServiceRuntime)
+    public void unregister(HttpService httpService)
     {
         // TODO Auto-generated method stub
     }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ServletMapping.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ServletMapping.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ServletMapping.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ServletMapping.java Wed Jun 25 09:52:05 2014
@@ -17,73 +17,49 @@
 package org.apache.felix.http.whiteboard.internal.manager;
 
 import javax.servlet.Servlet;
+import javax.servlet.ServletException;
 
-import org.apache.felix.http.api.ExtHttpServiceRuntime;
-import org.apache.felix.http.base.internal.logger.SystemLogger;
+import org.apache.felix.http.api.ExtHttpService;
+import org.apache.felix.http.api.ServletInfo;
 import org.osgi.framework.Bundle;
 import org.osgi.service.http.HttpService;
-import org.osgi.service.http.runtime.HttpServiceRuntime;
-import org.osgi.service.http.runtime.dto.ServletDTO;
+import org.osgi.service.http.NamespaceException;
 
-public final class ServletMapping
-    extends AbstractMapping<ServletDTO>
+public final class ServletMapping extends AbstractMapping
 {
     private final Servlet servlet;
+    private final ServletInfo servletInfo;
 
-    public ServletMapping(Bundle bundle, ServletDTO dto, Servlet servlet)
+    public ServletMapping(Bundle bundle, Servlet servlet, ServletInfo servletInfo)
     {
-        super(bundle, dto);
+        super(bundle);
         this.servlet = servlet;
+        this.servletInfo = servletInfo;
     }
 
-    Servlet getServlet()
+    @Override
+    public void register(HttpService httpService) throws ServletException, NamespaceException
     {
-        return this.servlet;
+        if (!isRegistered() && (httpService instanceof ExtHttpService) && getContext() != null)
+        {
+            this.servletInfo.context = getContext(); // XXX
+            ((ExtHttpService) httpService).registerServlet(this.servlet, this.servletInfo);
+            setRegistered(true);
+        }
     }
 
-    public void register(HttpService httpService, HttpServiceRuntime httpServiceRuntime)
+    @Override
+    public void unregister(HttpService httpService)
     {
-        if (!this.isRegistered() && getContext() != null)
+        if (isRegistered() && (httpService instanceof ExtHttpService))
         {
-            if (getDto().patterns != null && getDto().patterns.length > 0)
-            {
-                for (String pattern : getDto().patterns)
-                {
-                    try
-                    {
-                        httpService.registerServlet(pattern, this.servlet, getInitParams(), getContext());
-
-                        if (httpServiceRuntime instanceof ExtHttpServiceRuntime)
-                        {
-                            ServletDTO servletDTO = new ServletDTO();
-                            servletDTO.asyncSupported = getDto().asyncSupported;
-                            servletDTO.initParams = getDto().initParams;
-                            servletDTO.name = getDto().name;
-                            servletDTO.patterns = new String[]{ pattern };
-                            servletDTO.serviceId = getDto().serviceId;
-                            servletDTO.servletContextId = getDto().servletContextId;
-                            servletDTO.servletInfo = getDto().servletInfo;
-                            ((ExtHttpServiceRuntime) httpServiceRuntime).registerServlet(servletDTO);
-                        }
-                    }
-                    catch (Throwable t)
-                    {
-                        SystemLogger.error("Failed to register servlet", t);
-                    }
-                }
-                this.setRegistered(true);
-            }
+            ((ExtHttpService) httpService).unregisterServlet(this.servlet);
+            setRegistered(false);
         }
     }
 
-    public void unregister(HttpService httpService, HttpServiceRuntime httpServiceRuntime)
+    Servlet getServlet()
     {
-        if (this.isRegistered())
-        {
-            for (String pattern : getDto().patterns) {
-                httpService.unregister(pattern);
-            }
-            this.setRegistered(false);
-        }
+        return this.servlet;
     }
 }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/AbstractTracker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/AbstractTracker.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/AbstractTracker.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/AbstractTracker.java Wed Jun 25 09:52:05 2014
@@ -16,12 +16,15 @@
  */
 package org.apache.felix.http.whiteboard.internal.tracker;
 
+import javax.servlet.ServletException;
+
+import org.apache.felix.http.base.internal.logger.SystemLogger;
+import org.osgi.service.http.NamespaceException;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
-public abstract class AbstractTracker<T>
-    extends ServiceTracker
+public abstract class AbstractTracker<T> extends ServiceTracker
 {
     public AbstractTracker(BundleContext context, Class<T> clz)
     {
@@ -32,9 +35,17 @@ public abstract class AbstractTracker<T>
     @SuppressWarnings("unchecked")
     public final Object addingService(ServiceReference ref)
     {
-        T service = (T)super.addingService(ref);
-        added(service, ref);
-        return service;
+        try
+        {
+            T service = (T) super.addingService(ref);
+            added(service, ref);
+            return service;
+        }
+        catch (Exception e)
+        {
+            SystemLogger.warning("Failed to add service!", e); // XXX log more information!
+        }
+        return null;
     }
 
     @Override
@@ -48,13 +59,20 @@ public abstract class AbstractTracker<T>
     @SuppressWarnings("unchecked")
     public final void removedService(ServiceReference ref, Object service)
     {
-        super.removedService(ref, service);
-        removed((T) service, ref);
+        try
+        {
+            super.removedService(ref, service);
+            removed((T) service, ref);
+        }
+        catch (Exception e)
+        {
+            SystemLogger.warning("Failed to remove service!", e); // XXX log more information!
+        }
     }
 
-    protected abstract void modified(T service, ServiceReference ref);
+    protected abstract void modified(T service, ServiceReference ref) throws ServletException, NamespaceException;
 
-    protected abstract void added(T service, ServiceReference ref);
+    protected abstract void added(T service, ServiceReference ref) throws ServletException, NamespaceException;
 
-    protected abstract void removed(T service, ServiceReference ref);
+    protected abstract void removed(T service, ServiceReference ref) throws ServletException;
 }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/FilterTracker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/FilterTracker.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/FilterTracker.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/FilterTracker.java Wed Jun 25 09:52:05 2014
@@ -17,12 +17,14 @@
 package org.apache.felix.http.whiteboard.internal.tracker;
 
 import javax.servlet.Filter;
+import javax.servlet.ServletException;
+
 import org.apache.felix.http.whiteboard.internal.manager.ExtenderManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.NamespaceException;
 
-public final class FilterTracker
-    extends AbstractTracker<Filter>
+public final class FilterTracker extends AbstractTracker<Filter>
 {
     private final ExtenderManager manager;
 
@@ -32,18 +34,18 @@ public final class FilterTracker
         this.manager = manager;
     }
 
-    protected void added(Filter service, ServiceReference ref)
+    protected void added(Filter service, ServiceReference ref) throws ServletException, NamespaceException
     {
         this.manager.add(service, ref);
     }
 
-    protected void modified(Filter service, ServiceReference ref)
+    protected void modified(Filter service, ServiceReference ref) throws ServletException, NamespaceException
     {
         removed(service, ref);
         added(service, ref);
     }
 
-    protected void removed(Filter service, ServiceReference ref)
+    protected void removed(Filter service, ServiceReference ref) throws ServletException
     {
         this.manager.remove(ref);
     }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpContextTracker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpContextTracker.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpContextTracker.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpContextTracker.java Wed Jun 25 09:52:05 2014
@@ -16,13 +16,15 @@
  */
 package org.apache.felix.http.whiteboard.internal.tracker;
 
+import javax.servlet.ServletException;
+
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.NamespaceException;
 import org.apache.felix.http.whiteboard.internal.manager.ExtenderManager;
 
-public final class HttpContextTracker
-    extends AbstractTracker<HttpContext>
+public final class HttpContextTracker extends AbstractTracker<HttpContext>
 {
     private final ExtenderManager manager;
 
@@ -32,18 +34,18 @@ public final class HttpContextTracker
         this.manager = manager;
     }
 
-    protected void added(HttpContext service, ServiceReference ref)
+    protected void added(HttpContext service, ServiceReference ref) throws ServletException, NamespaceException
     {
         this.manager.add(service, ref);
     }
 
-    protected void modified(HttpContext service, ServiceReference ref)
+    protected void modified(HttpContext service, ServiceReference ref) throws ServletException, NamespaceException
     {
         removed(service, ref);
         added(service, ref);
     }
 
-    protected void removed(HttpContext service, ServiceReference ref)
+    protected void removed(HttpContext service, ServiceReference ref) throws ServletException
     {
         this.manager.remove(service);
     }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpServiceTracker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpServiceTracker.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpServiceTracker.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpServiceTracker.java Wed Jun 25 09:52:05 2014
@@ -16,13 +16,15 @@
  */
 package org.apache.felix.http.whiteboard.internal.tracker;
 
+import javax.servlet.ServletException;
+
 import org.apache.felix.http.whiteboard.internal.manager.ExtenderManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
 
-public final class HttpServiceTracker
-    extends AbstractTracker<HttpService>
+public final class HttpServiceTracker extends AbstractTracker<HttpService>
 {
     private final ExtenderManager manager;
 
@@ -32,17 +34,17 @@ public final class HttpServiceTracker
         this.manager = manager;
     }
 
-    protected void added(HttpService service, ServiceReference ref)
+    protected void added(HttpService service, ServiceReference ref) throws ServletException, NamespaceException
     {
         this.manager.setHttpService(service);
     }
 
-    protected void modified(HttpService service, ServiceReference ref)
+    protected void modified(HttpService service, ServiceReference ref) throws ServletException, NamespaceException
     {
         // Do nothing
     }
 
-    protected void removed(HttpService service, ServiceReference ref)
+    protected void removed(HttpService service, ServiceReference ref) throws ServletException
     {
         this.manager.unsetHttpService();
     }

Modified: felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/ServletTracker.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/ServletTracker.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/ServletTracker.java (original)
+++ felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/ServletTracker.java Wed Jun 25 09:52:05 2014
@@ -19,10 +19,12 @@ package org.apache.felix.http.whiteboard
 import org.apache.felix.http.whiteboard.internal.manager.ExtenderManager;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.NamespaceException;
+
 import javax.servlet.Servlet;
+import javax.servlet.ServletException;
 
-public final class ServletTracker
-    extends AbstractTracker<Servlet>
+public final class ServletTracker extends AbstractTracker<Servlet>
 {
     private final ExtenderManager manager;
 
@@ -32,18 +34,18 @@ public final class ServletTracker
         this.manager = manager;
     }
 
-    protected void added(Servlet service, ServiceReference ref)
+    protected void added(Servlet service, ServiceReference ref) throws ServletException, NamespaceException
     {
         this.manager.add(service, ref);
     }
 
-    protected void modified(Servlet service, ServiceReference ref)
+    protected void modified(Servlet service, ServiceReference ref) throws ServletException, NamespaceException
     {
         removed(service, ref);
         added(service, ref);
     }
 
-    protected void removed(Servlet service, ServiceReference ref)
+    protected void removed(Servlet service, ServiceReference ref) throws ServletException
     {
         this.manager.remove(ref);
     }