felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1605310 [1/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...
Date Wed, 25 Jun 2014 09:52:06 GMT
Author: jawi
Date: Wed Jun 25 09:52:05 2014
New Revision: 1605310

URL: http://svn.apache.org/r1605310
Log:
RFC-189 / FELIX-4541 / FELIX-1651:

- extended the ExtHttpService API with two new methods to allow servlet & filter
  registrations with all the extra information introduced by RFC-189. This no longer
  makes it necessary to use the *DTOs for this, as these classes serve a different
  purpose at runtime and should not be used for registration purposes;
- refactored the whiteboard implementation to no longer use the DTOs for registration
  of servlets and filters, but use the new ExtHttpService API instead;
- deprecated the ExtHttpServiceRuntime and its methods, as it currently is not 
  necessary to provide a customized version of the HttpServiceRuntime from Felix 
  (the registration methods are now covered by the ExtHttpService);
- added initial support for multiple patterns and regexs (= filters only), which
  seems to work, but need some additional work and tests to properly validate the
  implementation;
- reworked some of the unit/integration tests to get them up and running again;
- bumped most versions in the projects to 3.0.0, which is still up for discussion,
  as it might not be necessary for *all* projects to do so...


Added:
    felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/FilterInfo.java   (with props)
    felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ServletInfo.java   (with props)
    felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/service/
    felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/service/HttpServiceImplTest.java   (with props)
    felix/sandbox/http-rfc189/itest/src/main/
    felix/sandbox/http-rfc189/itest/src/main/java/
Removed:
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpServiceRuntimeTracker.java
Modified:
    felix/sandbox/http-rfc189/api/pom.xml
    felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpService.java
    felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpServiceRuntime.java
    felix/sandbox/http-rfc189/base/pom.xml
    felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/AbstractHandler.java
    felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java
    felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java
    felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServicePlugin.java
    felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java
    felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java
    felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
    felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/AbstractHandlerTest.java
    felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java
    felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/ServletHandlerTest.java
    felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
    felix/sandbox/http-rfc189/bridge/pom.xml
    felix/sandbox/http-rfc189/bundle/pom.xml
    felix/sandbox/http-rfc189/cometd/pom.xml
    felix/sandbox/http-rfc189/itest/pom.xml
    felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java
    felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
    felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java
    felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java
    felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java
    felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/RequestDispatchTest.java
    felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/ResourceTest.java
    felix/sandbox/http-rfc189/jetty/pom.xml
    felix/sandbox/http-rfc189/parent/pom.xml
    felix/sandbox/http-rfc189/samples/bridge/pom.xml
    felix/sandbox/http-rfc189/samples/cometd/pom.xml
    felix/sandbox/http-rfc189/samples/filter/pom.xml
    felix/sandbox/http-rfc189/samples/whiteboard/pom.xml
    felix/sandbox/http-rfc189/servlet-api/pom.xml
    felix/sandbox/http-rfc189/sslfilter/pom.xml
    felix/sandbox/http-rfc189/whiteboard/pom.xml
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/WhiteboardActivator.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/AbstractMapping.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ErrorPageMapping.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ExtenderManager.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/FilterMapping.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpContextManager.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/HttpWhiteboardWebConsolePlugin.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ResourceMapping.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/manager/ServletMapping.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/AbstractTracker.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/FilterTracker.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpContextTracker.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/HttpServiceTracker.java
    felix/sandbox/http-rfc189/whiteboard/src/main/java/org/apache/felix/http/whiteboard/internal/tracker/ServletTracker.java
    felix/sandbox/http-rfc189/whiteboard/src/test/java/org/apache/felix/http/whiteboard/internal/manager/ExtenderManagerTest.java
    felix/sandbox/http-rfc189/whiteboard/src/test/java/org/apache/felix/http/whiteboard/internal/manager/FilterMappingTest.java
    felix/sandbox/http-rfc189/whiteboard/src/test/java/org/apache/felix/http/whiteboard/internal/manager/HttpContextManagerTest.java
    felix/sandbox/http-rfc189/whiteboard/src/test/java/org/apache/felix/http/whiteboard/internal/manager/ServletMappingTest.java

Modified: felix/sandbox/http-rfc189/api/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/api/pom.xml (original)
+++ felix/sandbox/http-rfc189/api/pom.xml Wed Jun 25 09:52:05 2014
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Api</name>
     <artifactId>org.apache.felix.http.api</artifactId>
-    <version>2.3.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <scm>
@@ -50,7 +50,9 @@
                             org.osgi.service.http.runtime;version=1.0.0,
                             org.osgi.service.http.runtime.dto;version=1.0.0,
                             org.osgi.service.http.whiteboard;version=1.0.0,
-                            org.apache.felix.http.api;version=${http.api.version}
+                            org.apache.felix.http.api;version=${http.api.version},
+                            org.osgi.annotation.versioning;version=1.0.0,
+                            org.osgi.dto;version=1.0.0
                         </Export-Package>
                         <Import-Package>
                             org.osgi.dto,
@@ -93,6 +95,11 @@
             <artifactId>org.osgi.compendium</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 
 </project>

Modified: felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpService.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpService.java (original)
+++ felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpService.java Wed Jun 25 09:52:05 2014
@@ -16,20 +16,90 @@
  */
 package org.apache.felix.http.api;
 
+import java.util.Dictionary;
+
 import javax.servlet.Filter;
 import javax.servlet.Servlet;
 import javax.servlet.ServletException;
-import org.osgi.service.http.HttpService;
+
 import org.osgi.service.http.HttpContext;
-import java.util.Dictionary;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
 
-public interface ExtHttpService
-    extends HttpService
+import aQute.bnd.annotation.ProviderType;
+
+/**
+ * The {@link ExtHttpService} allows other bundles in the OSGi environment to dynamically
+ * register resources, {@link Filter}s and {@link Servlet}s into the URI namespace of a 
+ * HTTP service implementation. A bundle may later unregister its resources, {@link Filter}s
+ * or {@link Servlet}s.
+ * 
+ * @see HttpContext
+ */
+@ProviderType
+public interface ExtHttpService extends HttpService
 {
-    public void registerFilter(Filter filter, String pattern, Dictionary initParams, int ranking, HttpContext context)
-        throws ServletException;
-    
-    public void unregisterFilter(Filter filter);
+    /**
+     * Allows for programmatic registration of a {@link Filter} instance. 
+     * 
+     * @param filter the {@link Filter} to register, cannot be <code>null</code>;
+     * @param pattern the filter pattern to register the for, cannot be <code>null</code> and 
+     *        should be a valid regular expression;
+     * @param initParams the initialization parameters passed to the given filter during its 
+     *        initialization, can be <code>null</code> in case no additional parameters should 
+     *        be provided;
+     * @param ranking defines the order in which filters are called. A higher ranking causes 
+     *        the filter to be placed earlier in the filter chain;
+     * @param context the optional {@link HttpContext} to associate with this filter, can be
+     *        <code>null</code> in case a default context should be associated.
+     * @throws ServletException in case the registration failed, for example because the 
+     *         initialization failed or due any other problem;
+     * @throws IllegalArgumentException in case the given filter was <code>null</code>.
+     */
+    void registerFilter(Filter filter, String pattern, Dictionary initParams, int ranking, HttpContext context) throws ServletException;
+
+    /**
+     * Allows for programmatic registration of a {@link Filter} instance. 
+     * 
+     * @param filter the {@link Filter} to register, cannot be <code>null</code>;
+     * @param filterInfo the registration details, cannot be <code>null</code>. 
+     * @throws ServletException in case the registration failed, for example because the 
+     *         initialization failed or due any other problem.
+     * @throws IllegalArgumentException in case the given filter and/or filter information 
+     *         was <code>null</code>.
+     */
+    void registerFilter(Filter filter, FilterInfo filterInfo) throws ServletException;
+
+    /**
+     * Allows for programmatic registration of a {@link Servlet} instance.
+     * 
+     * @param servlet the {@link Servlet} to register, cannot be <code>null</code>;
+     * @param servletInfo the registration details, cannot be <code>null</code>.
+     * @throws ServletException in case the registration of the servlet failed, for example
+     *         because the initialization failed or due to any other problem;
+     * @throws NamespaceException in case one of the servlet paths is already in use. 
+     * @throws IllegalArgumentException in case the given servlet and/or servlet information 
+     *         was <code>null</code>.
+     */
+    void registerServlet(Servlet servlet, ServletInfo servletInfo) throws ServletException, NamespaceException;
+
+    /**
+     * Unregisters a previously registered {@link Filter}.
+     * <p>
+     * In case the given filter is not registered, this method is essentially a no-op.
+     * </p>
+     * 
+     * @param filter the {@link Filter} to unregister, cannot be <code>null</code>.
+     */
+    void unregisterFilter(Filter filter);
 
-    public void unregisterServlet(Servlet servlet);
+    /**
+     * Unregisters a previously registered {@link Servlet}.
+     * <p>
+     * In case the given servlet is not registered, this method is essentially a no-op.
+     * </p>
+     * 
+     * @param servlet the {@link Servlet} to unregister, cannot be <code>null</code>.
+     */
+    void unregisterServlet(Servlet servlet);
 }

Modified: felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpServiceRuntime.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpServiceRuntime.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpServiceRuntime.java (original)
+++ felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ExtHttpServiceRuntime.java Wed Jun 25 09:52:05 2014
@@ -20,9 +20,12 @@ import org.osgi.service.http.runtime.Htt
 import org.osgi.service.http.runtime.dto.FilterDTO;
 import org.osgi.service.http.runtime.dto.ServletDTO;
 
+/**
+ * JaWi - 2014-06-13: I'm not sure this should be part of the external API of Felix HTTP. Consumers are not expected to call these methods directly, so no need to expose these methods publicly. Discussed with Simone on Skype. 
+ */
+@Deprecated
 public interface ExtHttpServiceRuntime extends HttpServiceRuntime
 {
-
     void registerServlet(ServletDTO servletDTO);
 
     void registerFilter(FilterDTO filterDTO);

Added: felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/FilterInfo.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/FilterInfo.java?rev=1605310&view=auto
==============================================================================
--- felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/FilterInfo.java (added)
+++ felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/FilterInfo.java Wed Jun 25 09:52:05 2014
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.http.api;
+
+import java.util.Map;
+
+import javax.servlet.DispatcherType;
+import javax.servlet.Filter;
+
+import org.osgi.dto.DTO;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.runtime.dto.FilterDTO;
+
+import aQute.bnd.annotation.ConsumerType;
+
+/**
+ * Provides registration information for a {@link Filter}, and is used to programmatically register {@link Filter}s.
+ * <p>
+ * This class only provides information used at registration time, and as such differs slightly from {@link DTO}s like, {@link FilterDTO}.
+ * </p>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@ConsumerType
+public final class FilterInfo
+{
+    /**
+     * The name of the servlet.
+     */
+    public String name;
+
+    /**
+     * The request mappings for the servlet.
+     * <p>
+     * The specified patterns are used to determine whether a request is mapped to the servlet filter.<br>
+     * Note that these patterns should conform to the Servlet specification.
+     * </p>
+     */
+    public String[] patterns;
+
+    /**
+     * The servlet names for the servlet filter.
+     * <p>
+     * The specified names are used to determine the servlets whose requests are mapped to the servlet filter.
+     * </p>
+     */
+    public String[] servletNames;
+
+    /**
+     * The request mappings for the servlet filter.
+     * <p>
+     * The specified regular expressions are used to determine whether a request is mapped to the servlet filter.<br>
+     * These regular expressions are a convenience extension allowing one to specify filters that match paths that are difficult to match with plain Servlet patterns alone.
+     * </p>
+     */
+    public String[] regexs;
+
+    /**
+     * Specifies whether the servlet filter supports asynchronous processing.
+     */
+    public boolean asyncSupported = false;
+
+    /**
+     * Specifies the ranking order in which this filter should be called. Higher rankings are called first.
+     */
+    public int ranking = 0;
+
+    /**
+     * The dispatcher associations for the servlet filter.
+     * <p>
+     * The specified names are used to determine in what occasions the servlet filter is called. 
+     * See {@link DispatcherType} and Servlet 3.0 specification, section 6.2.5.
+     * </p>
+     */
+    public String[] dispatcher = { "REQUEST" };
+
+    /**
+     * The filter initialization parameters as provided during registration of the filter.
+     */
+    public Map<String, String> initParams;
+
+    /**
+     * The {@link HttpContext} for the servlet.
+     */
+    public HttpContext context;
+
+}

Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/FilterInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ServletInfo.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ServletInfo.java?rev=1605310&view=auto
==============================================================================
--- felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ServletInfo.java (added)
+++ felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ServletInfo.java Wed Jun 25 09:52:05 2014
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.http.api;
+
+import java.util.Map;
+
+import javax.servlet.Servlet;
+
+import org.osgi.dto.DTO;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.runtime.dto.ServletDTO;
+
+import aQute.bnd.annotation.ConsumerType;
+
+/**
+ * Provides registration information for a {@link Servlet}, and is used to programmatically register {@link Servlet}s.
+ * <p>
+ * This class only provides information used at registration time, and as such differs slightly from {@link DTO}s like, {@link ServletDTO}.
+ * </p>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@ConsumerType
+public final class ServletInfo
+{
+    /**
+     * The name of the servlet.
+     */
+    public String name;
+
+    /**
+     * The request mappings for the servlet.
+     * <p>
+     * The specified patterns are used to determine whether a request is mapped to the servlet.
+     * </p>
+     */
+    public String[] patterns;
+
+    /**
+     * The error pages and/or codes.
+     */
+    public String[] errorPage;
+
+    /**
+     * Specifies whether the servlet supports asynchronous processing.
+     */
+    public boolean asyncSupported = false;
+
+    /**
+     * The servlet initialization parameters as provided during registration of the servlet.
+     */
+    public Map<String, String> initParams;
+
+    /**
+     * The {@link HttpContext} for the servlet.
+     */
+    public HttpContext context;
+
+}

Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/apache/felix/http/api/ServletInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: felix/sandbox/http-rfc189/base/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/pom.xml (original)
+++ felix/sandbox/http-rfc189/base/pom.xml Wed Jun 25 09:52:05 2014
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Base</name>
     <artifactId>org.apache.felix.http.base</artifactId>
-    <version>2.3.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <scm>

Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/AbstractHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/AbstractHandler.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/AbstractHandler.java (original)
+++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/AbstractHandler.java Wed Jun 25 09:52:05 2014
@@ -61,6 +61,12 @@ public abstract class AbstractHandler
 
     public abstract void init() throws ServletException;
 
+    public final void setInitParams(Map<String, String> map)
+    {
+        this.initParams.clear();
+        this.initParams.putAll(map);
+    }
+
     public final void setInitParams(Dictionary map)
     {
         this.initParams.clear();

Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java (original)
+++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/FilterHandler.java Wed Jun 25 09:52:05 2014
@@ -16,7 +16,9 @@
  */
 package org.apache.felix.http.base.internal.handler;
 
-import static javax.servlet.http.HttpServletResponse.*;
+import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
+import static javax.servlet.http.HttpServletResponse.SC_OK;
+
 import java.io.IOException;
 import java.util.regex.Pattern;
 
@@ -31,15 +33,21 @@ import org.apache.felix.http.base.intern
 public final class FilterHandler extends AbstractHandler implements Comparable<FilterHandler>
 {
     private final Filter filter;
-    private final Pattern regex;
+    private final String[] patternStrings;
+    private final Pattern[] patterns;
     private final int ranking;
 
-    public FilterHandler(ExtServletContext context, Filter filter, String pattern, int ranking, String name)
+    public FilterHandler(ExtServletContext context, Filter filter, String[] patterns, int ranking, String name)
     {
         super(context, name);
         this.filter = filter;
         this.ranking = ranking;
-        this.regex = Pattern.compile(pattern);
+        this.patternStrings = patterns;
+        this.patterns = new Pattern[patterns.length];
+        for (int i = 0; i < patterns.length; i++)
+        {
+            this.patterns[i] = Pattern.compile(patterns[i]);
+        }
     }
 
     public int compareTo(FilterHandler other)
@@ -62,9 +70,9 @@ public final class FilterHandler extends
         return this.filter;
     }
 
-    public String getPattern()
+    public String[] getPatterns()
     {
-        return regex.toString();
+        return patternStrings;
     }
 
     public int getRanking()
@@ -97,8 +105,14 @@ public final class FilterHandler extends
         {
             uri = "/";
         }
-
-        return this.regex.matcher(uri).matches();
+        for (Pattern p : this.patterns)
+        {
+            if (p.matcher(uri).matches())
+            {
+                return true;
+            }
+        }
+        return false;
     }
 
     final void doHandle(HttpServletRequest req, HttpServletResponse res, FilterChain chain) throws ServletException, IOException

Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java (original)
+++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HandlerRegistry.java Wed Jun 25 09:52:05 2014
@@ -28,47 +28,19 @@ public final class HandlerRegistry
 {
     private final Map<Servlet, ServletHandler> servletMap;
     private final Map<Filter, FilterHandler> filterMap;
-    private final Map<String, Servlet> aliasMap;
-    private ServletHandler[] servlets;
-    private FilterHandler[] filters;
+    private final Map<String, Servlet> servletPatternMap;
+    private volatile ServletHandler[] servlets;
+    private volatile FilterHandler[] filters;
 
     public HandlerRegistry()
     {
         this.servletMap = new HashMap<Servlet, ServletHandler>();
         this.filterMap = new HashMap<Filter, FilterHandler>();
-        this.aliasMap = new HashMap<String, Servlet>();
+        this.servletPatternMap = new HashMap<String, Servlet>();
         this.servlets = new ServletHandler[0];
         this.filters = new FilterHandler[0];
     }
 
-    public ServletHandler[] getServlets()
-    {
-        return this.servlets;
-    }
-
-    public FilterHandler[] getFilters()
-    {
-        return this.filters;
-    }
-
-    public synchronized void addServlet(ServletHandler handler) throws ServletException, NamespaceException
-    {
-        if (this.servletMap.containsKey(handler.getServlet()))
-        {
-            throw new ServletException("Servlet instance already registered");
-        }
-
-        if (this.aliasMap.containsKey(handler.getAlias()))
-        {
-            throw new NamespaceException("Servlet with alias already registered");
-        }
-
-        handler.init();
-        this.servletMap.put(handler.getServlet(), handler);
-        this.aliasMap.put(handler.getAlias(), handler.getServlet());
-        updateServletArray();
-    }
-
     public synchronized void addFilter(FilterHandler handler) throws ServletException
     {
         if (this.filterMap.containsKey(handler.getFilter()))
@@ -78,39 +50,44 @@ public final class HandlerRegistry
 
         handler.init();
         this.filterMap.put(handler.getFilter(), handler);
+
         updateFilterArray();
     }
 
-    public synchronized void removeServlet(Servlet servlet, final boolean destroy)
+    public synchronized void addServlet(ServletHandler handler) throws ServletException, NamespaceException
     {
-        ServletHandler handler = this.servletMap.remove(servlet);
-        if (handler != null)
+        if (this.servletMap.containsKey(handler.getServlet()))
         {
-            updateServletArray();
-            this.aliasMap.remove(handler.getAlias());
-            if (destroy)
+            throw new ServletException("Servlet instance " + handler.getName() + " already registered");
+        }
+        for (String pattern : handler.getPatterns())
+        {
+            if (this.servletPatternMap.containsKey(pattern))
             {
-                handler.destroy();
+                throw new ServletException("Servlet instance " + handler.getName() + " already registered");
             }
+            this.servletPatternMap.put(pattern, handler.getServlet());
         }
+
+        handler.init();
+        this.servletMap.put(handler.getServlet(), handler);
+
+        updateServletArray();
     }
 
-    public synchronized void removeFilter(Filter filter, final boolean destroy)
+    public FilterHandler[] getFilters()
     {
-        FilterHandler handler = this.filterMap.remove(filter);
-        if (handler != null)
-        {
-            updateFilterArray();
-            if (destroy)
-            {
-                handler.destroy();
-            }
-        }
+        return this.filters;
     }
 
     public synchronized Servlet getServletByAlias(String alias)
     {
-        return this.aliasMap.get(alias);
+        return this.servletPatternMap.get(alias);
+    }
+
+    public ServletHandler[] getServlets()
+    {
+        return this.servlets;
     }
 
     public synchronized void removeAll()
@@ -127,17 +104,42 @@ public final class HandlerRegistry
 
         this.servletMap.clear();
         this.filterMap.clear();
-        this.aliasMap.clear();
+        this.servletPatternMap.clear();
 
         updateServletArray();
         updateFilterArray();
     }
 
-    private void updateServletArray()
+    public synchronized void removeFilter(Filter filter, final boolean destroy)
     {
-        ServletHandler[] tmp = this.servletMap.values().toArray(new ServletHandler[this.servletMap.size()]);
-        Arrays.sort(tmp);
-        this.servlets = tmp;
+        FilterHandler handler = this.filterMap.remove(filter);
+        if (handler != null)
+        {
+            updateFilterArray();
+            if (destroy)
+            {
+                handler.destroy();
+            }
+        }
+    }
+
+    public synchronized void removeServlet(Servlet servlet, final boolean destroy)
+    {
+        ServletHandler handler = this.servletMap.remove(servlet);
+        if (handler != null)
+        {
+            updateServletArray();
+
+            for (String pattern : handler.getPatterns())
+            {
+                this.servletPatternMap.remove(pattern);
+            }
+
+            if (destroy)
+            {
+                handler.destroy();
+            }
+        }
     }
 
     private void updateFilterArray()
@@ -146,4 +148,11 @@ public final class HandlerRegistry
         Arrays.sort(tmp);
         this.filters = tmp;
     }
+
+    private void updateServletArray()
+    {
+        ServletHandler[] tmp = this.servletMap.values().toArray(new ServletHandler[this.servletMap.size()]);
+        Arrays.sort(tmp);
+        this.servlets = tmp;
+    }
 }

Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServicePlugin.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServicePlugin.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServicePlugin.java (original)
+++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServicePlugin.java Wed Jun 25 09:52:05 2014
@@ -92,7 +92,7 @@ public class HttpServicePlugin extends H
         for (FilterHandler filter : filters)
         {
             pw.println("<tr class=\"" + rowClass + " ui-state-default\">");
-            pw.println("<td>" + filter.getPattern() + "</td>");
+            pw.println("<td>" + Arrays.toString(filter.getPatterns()) + "</td>");
             pw.println("<td>" + filter.getFilter().getClass().getName() + "(" + filter.getRanking() + ")" + "</td>");
 
             printBundleDetails(pw, filter.getFilter().getClass());
@@ -126,7 +126,7 @@ public class HttpServicePlugin extends H
         {
 
             pw.println("<tr class=\"" + rowClass + " ui-state-default\">");
-            pw.println("<td>" + servlet.getAlias() + "</td>");
+            pw.println("<td>" + Arrays.toString(servlet.getPatterns()) + "</td>");
             pw.println("<td>" + servlet.getServlet().getClass().getName() + "</td>");
 
             printBundleDetails(pw, servlet.getServlet().getClass());
@@ -155,13 +155,11 @@ public class HttpServicePlugin extends H
         ServletHandler[] servlets = registry.getServlets();
         for (ServletHandler servlet : servlets)
         {
-            pw.println("Alias : " + servlet.getAlias());
-
+            pw.println("Patterns : " + Arrays.toString(servlet.getPatterns()));
             addSpace(pw, 1);
-            pw.println("Class  :" + servlet.getServlet().getClass().getName());
+            pw.println("Class    : " + servlet.getServlet().getClass().getName());
             addSpace(pw, 1);
-            pw.println("Bundle :" + getBundleDetails(servlet.getServlet().getClass()));
-
+            pw.println("Bundle   : " + getBundleDetails(servlet.getServlet().getClass()));
         }
 
         pw.println();
@@ -171,14 +169,13 @@ public class HttpServicePlugin extends H
         Arrays.sort(filters);
         for (FilterHandler filter : filters)
         {
-            pw.println("Pattern : " + filter.getPattern());
-
+            pw.println("Patterns : " + Arrays.toString(filter.getPatterns()));
             addSpace(pw, 1);
-            pw.println("Ranking :" + filter.getRanking());
+            pw.println("Ranking  : " + filter.getRanking());
             addSpace(pw, 1);
-            pw.println("Class   :" + filter.getFilter().getClass().getName());
+            pw.println("Class    : " + filter.getFilter().getClass().getName());
             addSpace(pw, 1);
-            pw.println("Bundle  :" + getBundleDetails(filter.getFilter().getClass()));
+            pw.println("Bundle   : " + getBundleDetails(filter.getFilter().getClass()));
         }
     }
 

Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java (original)
+++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java Wed Jun 25 09:52:05 2014
@@ -29,8 +29,11 @@ import static javax.servlet.RequestDispa
 import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
 import static javax.servlet.http.HttpServletResponse.SC_OK;
 import static org.apache.felix.http.base.internal.util.UriUtils.concat;
+import static org.apache.felix.http.base.internal.util.UriUtils.relativePath;
 
 import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
@@ -59,19 +62,18 @@ public final class ServletHandler extend
 
         public RequestDispatcherImpl()
         {
+            this.servletPath = null;
             this.requestURI = null;
-            // PathMap.pathMatch(servlet_path_spec,target);
-            this.servletPath = getAlias(); // XXX handle wildcard aliases!
             this.pathInfo = null;
             this.query = null;
             this.named = true;
         }
 
-        public RequestDispatcherImpl(String uri, String pathInContext, String query)
+        public RequestDispatcherImpl(String uri, String servletPath, String pathInContext, String query)
         {
             this.requestURI = uri;
-            this.servletPath = getAlias(); // XXX handle wildcard aliases!
-            this.pathInfo = this.servletPath.equals(pathInContext) ? null : pathInContext;
+            this.servletPath = servletPath;
+            this.pathInfo = relativePath(servletPath, pathInContext);
             this.query = query;
             this.named = false;
         }
@@ -234,19 +236,25 @@ public final class ServletHandler extend
         }
     }
 
-    private final String alias;
+    private final String[] patternStrings;
+    private final Pattern[] patterns;
     private final Servlet servlet;
 
-    public ServletHandler(ExtServletContext context, Servlet servlet, String alias, String name)
+    public ServletHandler(ExtServletContext context, Servlet servlet, String[] patterns, String name)
     {
         super(context, name);
-        this.alias = alias;
         this.servlet = servlet;
+        this.patternStrings = patterns;
+        this.patterns = new Pattern[patterns.length];
+        for (int i = 0; i < patterns.length; i++)
+        {
+            this.patterns[i] = Pattern.compile(patterns[i]);
+        }
     }
 
     public int compareTo(ServletHandler other)
     {
-        return other.alias.length() - this.alias.length();
+        return other.getId() - this.getId(); // XXX
     }
 
     public RequestDispatcher createNamedRequestDispatcher()
@@ -256,7 +264,19 @@ public final class ServletHandler extend
 
     public RequestDispatcher createRequestDispatcher(String path, String pathInContext, String query)
     {
-        return new RequestDispatcherImpl(path, pathInContext, query);
+        // Determine which servletPath we should use...
+        String servletPath = null;
+        for (Pattern pattern : this.patterns)
+        {
+            Matcher m = pattern.matcher(pathInContext);
+            if (m.find())
+            {
+                servletPath = m.groupCount() > 0 ? m.group(1) : m.group();
+                break;
+            }
+        }
+
+        return new RequestDispatcherImpl(path, servletPath, pathInContext, query);
     }
 
     public void destroy()
@@ -264,9 +284,9 @@ public final class ServletHandler extend
         this.servlet.destroy();
     }
 
-    public String getAlias()
+    public String[] getPatterns()
     {
-        return this.alias;
+        return patternStrings;
     }
 
     public Servlet getServlet()
@@ -310,19 +330,7 @@ public final class ServletHandler extend
 
     public boolean matches(String uri)
     {
-        // TODO handle wildcard aliases and extension specs...
-        if (uri == null)
-        {
-            return this.alias.equals("/");
-        }
-        else if (this.alias.equals("/"))
-        {
-            return uri.startsWith(this.alias);
-        }
-        else
-        {
-            return uri.equals(this.alias) || uri.startsWith(this.alias + "/");
-        }
+        return determineServletPath(uri) != null;
     }
 
     final void doHandle(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
@@ -331,7 +339,8 @@ public final class ServletHandler extend
         // not inclusions or forwards from servlets. Should solve FELIX-2774 and FELIX-3054... 
         if (DispatcherType.REQUEST == req.getDispatcherType())
         {
-            req = new ServletHandlerRequest(req, getContext(), this.alias);
+            String alias = determineServletPath(req.getRequestURI());
+            req = new ServletHandlerRequest(req, getContext(), alias);
         }
 
         if (getContext().handleSecurity(req, res))
@@ -354,4 +363,22 @@ public final class ServletHandler extend
     {
         return this.servlet;
     }
+
+    private String determineServletPath(String uri)
+    {
+        if (uri == null)
+        {
+            uri = "/";
+        }
+
+        for (int i = 0; i < this.patterns.length; i++)
+        {
+            Matcher matcher = this.patterns[i].matcher(uri);
+            if (matcher.find(0))
+            {
+                return matcher.groupCount() > 0 ? matcher.group(1) : matcher.group();
+            }
+        }
+        return null;
+    }
 }

Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java (original)
+++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceImpl.java Wed Jun 25 09:52:05 2014
@@ -16,8 +16,13 @@
  */
 package org.apache.felix.http.base.internal.service;
 
+import java.util.ArrayList;
 import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
 
 import javax.servlet.Filter;
 import javax.servlet.Servlet;
@@ -26,6 +31,8 @@ import javax.servlet.ServletContextAttri
 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.context.ExtServletContext;
 import org.apache.felix.http.base.internal.context.ServletContextManager;
 import org.apache.felix.http.base.internal.handler.FilterHandler;
@@ -53,54 +60,107 @@ public final class HttpServiceImpl imple
         this.contextManager = new ServletContextManager(this.bundle, context, servletAttributeListener, sharedContextAttributes);
     }
 
-    private ExtServletContext getServletContext(HttpContext context)
+    static Map<String, String> convertToMap(Dictionary dict)
     {
-        if (context == null)
+        Map<String, String> result = new HashMap<String, String>();
+        if (dict != null)
         {
-            context = createDefaultHttpContext();
+            Enumeration keyEnum = dict.keys();
+            while (keyEnum.hasMoreElements())
+            {
+                String key = String.valueOf(keyEnum.nextElement());
+                Object value = dict.get(key);
+                result.put(key, value == null ? null : String.valueOf(value));
+            }
         }
-
-        return this.contextManager.getServletContext(context);
+        return result;
     }
 
-    public void registerFilter(Filter filter, String pattern, Dictionary initParams, int ranking, HttpContext context) throws ServletException
+    static String convertToRegEx(String pattern)
     {
-        if (filter == null)
-        {
-            throw new IllegalArgumentException("Filter must not be null");
-        }
-        String filterName = null; // XXX
-        FilterHandler handler = new FilterHandler(getServletContext(context), filter, pattern, ranking, filterName);
-        handler.setInitParams(initParams);
-        this.handlerRegistry.addFilter(handler);
-        this.localFilters.add(filter);
+        // see Servlet 3.0, section 12.2
+        // - replace '*.' prefixes with a regex that matches extensions...
+        pattern = pattern.replaceFirst("^\\Q*.\\E(.*)$", "\\^(.*)(\\\\.$1)\\$");
+        // - replace '/*' suffixes with a regex that matches paths (actually, 
+        //   the path should also start with a leading slash, but we're a bit 
+        //   more liberal on this one)...
+        pattern = pattern.replaceFirst("^(.*)\\Q/*\\E$", "\\^($1)(|/.*)\\$");
+        return pattern;
     }
 
-    public void unregisterFilter(Filter filter)
+    static boolean isEmpty(String str)
     {
-        unregisterFilter(filter, true);
+        return str == null || "".equals(str.trim());
     }
 
-    public void unregisterServlet(Servlet servlet)
+    public HttpContext createDefaultHttpContext()
     {
-        unregisterServlet(servlet, true);
+        return new DefaultHttpContext(this.bundle);
     }
 
-    public void registerServlet(String alias, Servlet servlet, Dictionary initParams, HttpContext context) throws ServletException, NamespaceException
+    public void registerFilter(Filter filter, FilterInfo filterInfo) throws ServletException
     {
-        if (servlet == null)
+        if (filter == null)
+        {
+            throw new IllegalArgumentException("Filter cannot be null!");
+        }
+        if (filterInfo == null)
+        {
+            throw new IllegalArgumentException("FilterInfo cannot be null!");
+        }
+        if ((filterInfo.patterns == null || filterInfo.patterns.length < 1) && (filterInfo.regexs == null || filterInfo.regexs.length < 1))
         {
-            throw new IllegalArgumentException("Servlet must not be null");
+            throw new IllegalArgumentException("FilterInfo must have at least one pattern or regex!");
         }
-        if (!isAliasValid(alias))
+
+        String filterName = filterInfo.name;
+        if (isEmpty(filterName))
+        {
+            filterName = filter.getClass().getName();
+        }
+
+        Map<String, String> initParams = filterInfo.initParams;
+        ExtServletContext servletContext = getServletContext(filterInfo.context);
+        int ranking = Math.max(0, filterInfo.ranking);
+
+        // Compose a single array of all patterns & regexs the filter must represent...
+        String[] patterns = getFilterPatterns(filterInfo);
+
+        try
         {
-            throw new IllegalArgumentException("Malformed servlet alias [" + alias + "]");
+            FilterHandler handler = new FilterHandler(servletContext, filter, patterns, ranking, filterName);
+            handler.setInitParams(initParams);
+
+            synchronized (this)
+            {
+                if (this.localFilters.add(filter))
+                {
+                    this.handlerRegistry.addFilter(handler);
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            if (e instanceof ServletException)
+            {
+                throw (ServletException) e;
+            }
+            else
+            {
+                throw new ServletException("Failed to register filter " + filterName, e);
+            }
         }
-        String servletName = null; // XXX
-        ServletHandler handler = new ServletHandler(getServletContext(context), servlet, alias, servletName);
-        handler.setInitParams(initParams);
-        this.handlerRegistry.addServlet(handler);
-        this.localServlets.add(servlet);
+    }
+
+    public void registerFilter(Filter filter, String pattern, Dictionary initParams, int ranking, HttpContext context) throws ServletException
+    {
+        FilterInfo filterInfo = new FilterInfo();
+        filterInfo.patterns = new String[] { pattern };
+        filterInfo.initParams = convertToMap(initParams);
+        filterInfo.ranking = ranking;
+        filterInfo.context = context;
+
+        registerFilter(filter, filterInfo);
     }
 
     public void registerResources(String alias, String name, HttpContext context) throws NamespaceException
@@ -121,22 +181,89 @@ public final class HttpServiceImpl imple
         }
     }
 
-    public void unregister(String alias)
+    public void registerServlet(Servlet servlet, ServletInfo servletInfo) throws ServletException, NamespaceException
     {
-        final Servlet servlet = this.handlerRegistry.getServletByAlias(alias);
-        if ( servlet == null )
+        if (servlet == null)
         {
-            throw new IllegalArgumentException("Nothing registered at " + alias);
+            throw new IllegalArgumentException("Servlet cannot be null!");
+        }
+        if (servletInfo == null)
+        {
+            throw new IllegalArgumentException("ServletInfo cannot be null!");
+        }
+        if (servletInfo.patterns == null || servletInfo.patterns.length < 1)
+        {
+            throw new IllegalArgumentException("ServletInfo must at least have one pattern!");
+        }
+
+        String servletName = servletInfo.name;
+        if (isEmpty(servletName))
+        {
+            servletName = servlet.getClass().getName();
+        }
+
+        Map<String, String> initParams = servletInfo.initParams;
+        ExtServletContext servletContext = getServletContext(servletInfo.context);
+
+        // Compose a single array of all patterns/aliases the servlet must represent...
+        String[] patterns = new String[servletInfo.patterns.length];
+        for (int i = 0; i < servletInfo.patterns.length; i++)
+        {
+            patterns[i] = convertToRegEx(servletInfo.patterns[i]);
+        }
+
+        try
+        {
+            ServletHandler handler = new ServletHandler(servletContext, servlet, patterns, servletName);
+            handler.setInitParams(initParams);
+
+            synchronized (this)
+            {
+                if (this.localServlets.add(servlet))
+                {
+                    this.handlerRegistry.addServlet(handler);
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            if (e instanceof ServletException)
+            {
+                throw (ServletException) e;
+            }
+            else if (e instanceof NamespaceException)
+            {
+                throw (NamespaceException) e;
+            }
+            else
+            {
+                throw new ServletException("Failed to register servlet " + servletName, e);
+            }
         }
-        unregisterServlet(servlet);
     }
 
-    public HttpContext createDefaultHttpContext()
+    public void registerServlet(String alias, Servlet servlet, Dictionary initParams, HttpContext context) throws ServletException, NamespaceException
     {
-        return new DefaultHttpContext(this.bundle);
+        ServletInfo servletInfo = new ServletInfo();
+        servletInfo.patterns = new String[] { alias };
+        servletInfo.initParams = convertToMap(initParams);
+        servletInfo.context = context;
+
+        registerServlet(servlet, servletInfo);
+    }
+
+    public synchronized void unregister(String alias)
+    {
+        final Servlet servlet = this.handlerRegistry.getServletByAlias(alias);
+        if (servlet == null)
+        {
+            throw new IllegalArgumentException("Nothing registered at " + alias);
+        }
+
+        unregisterServlet(servlet);
     }
 
-    public void unregisterAll()
+    public synchronized void unregisterAll()
     {
         HashSet<Servlet> servlets = new HashSet<Servlet>(this.localServlets);
         for (Servlet servlet : servlets)
@@ -151,22 +278,44 @@ public final class HttpServiceImpl imple
         }
     }
 
-    private void unregisterFilter(Filter filter, final boolean destroy)
+    public synchronized void unregisterFilter(Filter filter)
     {
-        if (filter != null)
+        unregisterFilter(filter, true);
+    }
+
+    public synchronized void unregisterServlet(Servlet servlet)
+    {
+        unregisterServlet(servlet, true);
+    }
+
+    private String[] getFilterPatterns(FilterInfo filterInfo)
+    {
+        List<String> result = new ArrayList<String>();
+        if (filterInfo.patterns != null)
         {
-            this.handlerRegistry.removeFilter(filter, destroy);
-            this.localFilters.remove(filter);
+            for (int i = 0; i < filterInfo.patterns.length; i++)
+            {
+                result.add(convertToRegEx(filterInfo.patterns[i]));
+            }
+        }
+        if (filterInfo.regexs != null)
+        {
+            for (int i = 0; i < filterInfo.regexs.length; i++)
+            {
+                result.add(filterInfo.regexs[i]);
+            }
         }
+        return result.toArray(new String[result.size()]);
     }
 
-    private void unregisterServlet(Servlet servlet, final boolean destroy)
+    private ExtServletContext getServletContext(HttpContext context)
     {
-        if (servlet != null)
+        if (context == null)
         {
-            this.handlerRegistry.removeServlet(servlet, destroy);
-            this.localServlets.remove(servlet);
+            context = createDefaultHttpContext();
         }
+
+        return this.contextManager.getServletContext(context);
     }
 
     private boolean isNameValid(String name)
@@ -184,18 +333,21 @@ public final class HttpServiceImpl imple
         return true;
     }
 
-    private boolean isAliasValid(String alias)
+    private void unregisterFilter(Filter filter, final boolean destroy)
     {
-        if (alias == null)
+        if (filter != null)
         {
-            return false;
+            this.handlerRegistry.removeFilter(filter, destroy);
+            this.localFilters.remove(filter);
         }
+    }
 
-        if (!alias.equals("/") && (!alias.startsWith("/") || alias.endsWith("/")))
+    private void unregisterServlet(Servlet servlet, final boolean destroy)
+    {
+        if (servlet != null)
         {
-            return false;
+            this.handlerRegistry.removeServlet(servlet, destroy);
+            this.localServlets.remove(servlet);
         }
-
-        return true;
     }
 }

Modified: felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java (original)
+++ felix/sandbox/http-rfc189/base/src/main/java/org/apache/felix/http/base/internal/util/UriUtils.java Wed Jun 25 09:52:05 2014
@@ -37,6 +37,38 @@ public class UriUtils
     private static final char DOT = '.';
     private static final char SLASH = '/';
 
+    public static String relativePath(String base, String path)
+    {
+        if (path == null)
+        {
+            return null;
+        }
+        if (base == null)
+        {
+            return path;
+        }
+
+        int len = base.length();
+        if (base.endsWith("/"))
+        {
+            len--;
+        }
+        else if (!base.equals(path))
+        {
+            base = base.concat("/");
+        }
+
+        if (path.startsWith(base))
+        {
+            path = path.substring(len);
+        }
+        if ("".equals(path) || "/".equals(path))
+        {
+            return null;
+        }
+        return path;
+    }
+
     /**
      * Concatenates two paths keeping their respective path-parts into consideration.
      * 

Modified: felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/AbstractHandlerTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/AbstractHandlerTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/AbstractHandlerTest.java (original)
+++ felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/AbstractHandlerTest.java Wed Jun 25 09:52:05 2014
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.http.base.internal.handler;
 
+import java.util.Dictionary;
 import java.util.Hashtable;
 
 import org.apache.felix.http.base.internal.context.ExtServletContext;
@@ -51,7 +52,7 @@ public abstract class AbstractHandlerTes
         AbstractHandler handler = createHandler();
         Assert.assertEquals(0, handler.getInitParams().size());
 
-        Hashtable<String, String> map = new Hashtable<String, String>();
+        Dictionary<String, String> map = new Hashtable<String, String>();
         map.put("key1", "value1");
 
         handler.setInitParams(map);

Modified: felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java (original)
+++ felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java Wed Jun 25 09:52:05 2014
@@ -51,8 +51,8 @@ public class FilterHandlerTest extends A
     @Test
     public void testCompare()
     {
-        FilterHandler h1 = createHandler("a", 0);
-        FilterHandler h2 = createHandler("b", 10);
+        FilterHandler h1 = createHandler(0, "a");
+        FilterHandler h2 = createHandler(10, "b");
 
         assertEquals(1, h1.compareTo(h2));
         assertEquals(-1, h2.compareTo(h1));
@@ -61,7 +61,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testDestroy()
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         h1.destroy();
         verify(this.filter).destroy();
     }
@@ -69,7 +69,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testHandleFound() throws Exception
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         HttpServletRequest req = mock(HttpServletRequest.class);
         HttpServletResponse res = mock(HttpServletResponse.class);
         FilterChain chain = mock(FilterChain.class);
@@ -85,7 +85,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testHandleFoundContextRoot() throws Exception
     {
-        FilterHandler h1 = createHandler("/", 0);
+        FilterHandler h1 = createHandler(0, "/");
         HttpServletRequest req = mock(HttpServletRequest.class);
         HttpServletResponse res = mock(HttpServletResponse.class);
         FilterChain chain = mock(FilterChain.class);
@@ -104,7 +104,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testHandleFoundForbidden() throws Exception
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         HttpServletRequest req = mock(HttpServletRequest.class);
         HttpServletResponse res = mock(HttpServletResponse.class);
         FilterChain chain = mock(FilterChain.class);
@@ -129,7 +129,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testHandleFoundForbiddenCommittedOwnResponse() throws Exception
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         HttpServletRequest req = mock(HttpServletRequest.class);
         HttpServletResponse res = mock(HttpServletResponse.class);
         FilterChain chain = mock(FilterChain.class);
@@ -155,7 +155,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testHandleFoundForbiddenCustomStatusCode() throws Exception
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         HttpServletRequest req = mock(HttpServletRequest.class);
         HttpServletResponse res = mock(HttpServletResponse.class);
         FilterChain chain = mock(FilterChain.class);
@@ -178,7 +178,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testHandleNotFound() throws Exception
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         HttpServletRequest req = mock(HttpServletRequest.class);
         HttpServletResponse res = mock(HttpServletResponse.class);
         FilterChain chain = mock(FilterChain.class);
@@ -193,7 +193,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testHandleNotFoundContextRoot() throws Exception
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         HttpServletRequest req = mock(HttpServletRequest.class);
         HttpServletResponse res = mock(HttpServletResponse.class);
         FilterChain chain = mock(FilterChain.class);
@@ -208,7 +208,7 @@ public class FilterHandlerTest extends A
     @Test
     public void testInit() throws Exception
     {
-        FilterHandler h1 = createHandler("/a", 0);
+        FilterHandler h1 = createHandler(0, "/a");
         h1.init();
         verify(this.filter).init(any(FilterConfig.class));
     }
@@ -216,10 +216,10 @@ public class FilterHandlerTest extends A
     @Test
     public void testMatches()
     {
-        FilterHandler h1 = createHandler("/a/b", 0);
-        FilterHandler h2 = createHandler("/a/b/.+", 0);
-        FilterHandler h3 = createHandler("/", 0);
-        FilterHandler h4 = createHandler("/.*", 0);
+        FilterHandler h1 = createHandler(0, "/a/b");
+        FilterHandler h2 = createHandler(0, "/a/b/.+");
+        FilterHandler h3 = createHandler(0, "/");
+        FilterHandler h4 = createHandler(0, "/.*");
 
         assertFalse(h1.matches(null));
         assertFalse(h1.matches("/a"));
@@ -239,10 +239,10 @@ public class FilterHandlerTest extends A
 
     protected AbstractHandler createHandler()
     {
-        return createHandler("dummy", 0);
+        return createHandler(0, "dummy");
     }
 
-    private FilterHandler createHandler(String pattern, int ranking)
+    private FilterHandler createHandler(int ranking, String... pattern)
     {
         return new FilterHandler(this.context, this.filter, pattern, ranking, null /* name */);
     }

Modified: felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/ServletHandlerTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/ServletHandlerTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/ServletHandlerTest.java (original)
+++ felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/handler/ServletHandlerTest.java Wed Jun 25 09:52:05 2014
@@ -53,8 +53,8 @@ public class ServletHandlerTest extends 
         ServletHandler h1 = createHandler("/a");
         ServletHandler h2 = createHandler("/a/b");
 
-        assertEquals(2, h1.compareTo(h2));
-        assertEquals(-2, h2.compareTo(h1));
+        assertEquals(1, h1.compareTo(h2));
+        assertEquals(-1, h2.compareTo(h1));
     }
 
     @Test
@@ -225,7 +225,7 @@ public class ServletHandlerTest extends 
         return createHandler("/dummy");
     }
 
-    private ServletHandler createHandler(String alias)
+    private ServletHandler createHandler(String... alias)
     {
         return new ServletHandler(this.context, this.servlet, alias, null /* name */);
     }

Added: felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/service/HttpServiceImplTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/service/HttpServiceImplTest.java?rev=1605310&view=auto
==============================================================================
--- felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/service/HttpServiceImplTest.java (added)
+++ felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/service/HttpServiceImplTest.java Wed Jun 25 09:52:05 2014
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.http.base.internal.service;
+
+import static org.apache.felix.http.base.internal.service.HttpServiceImpl.convertToRegEx;
+import static org.junit.Assert.*;
+
+import java.util.regex.Pattern;
+
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class HttpServiceImplTest
+{
+
+    @Test
+    public void testConvertToRegExOk()
+    {
+        assertEquals("", convertToRegEx(""));
+        assertEquals("/", convertToRegEx("/"));
+        assertEquals("^(/foo/bar)(|/.*)$", convertToRegEx("/foo/bar/*"));
+        assertEquals("^(.*)(\\.bop)$", convertToRegEx("*.bop"));
+        assertEquals("^(.*)(\\.*)$", convertToRegEx("*.*"));
+    }
+
+    @Test
+    public void testConvertToRegExCreatesCorrectRegExOk()
+    {
+        Pattern p1 = Pattern.compile(convertToRegEx("/foo/bar/*"));
+        Pattern p2 = Pattern.compile(convertToRegEx("/baz/*"));
+        Pattern p3 = Pattern.compile(convertToRegEx("/catalog"));
+        Pattern p4 = Pattern.compile(convertToRegEx("*.bop"));
+
+        // Examples from the Servlet 3.0 spec, section 12.2.2...
+        assertTrue(p1.matcher("/foo/bar/index.html").matches());
+        assertTrue(p1.matcher("/foo/bar/index.bop").matches());
+        assertTrue(p2.matcher("/baz").matches());
+        assertTrue(p2.matcher("/baz/index.html").matches());
+        assertTrue(p3.matcher("/catalog").matches());
+        assertFalse(p3.matcher("/catalog/index.html").matches());
+        assertTrue(p4.matcher("/catalog/index.bop").matches());
+        assertTrue(p4.matcher("/index.bop").matches());
+    }
+
+}

Propchange: felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/service/HttpServiceImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java (original)
+++ felix/sandbox/http-rfc189/base/src/test/java/org/apache/felix/http/base/internal/util/UriUtilsTest.java Wed Jun 25 09:52:05 2014
@@ -31,6 +31,20 @@ import org.junit.Test;
 public class UriUtilsTest
 {
     @Test
+    public void testRelativePath()
+    {
+        assertEquals(null, relativePath("/foo", null));
+        assertEquals(null, relativePath("/foo", ""));
+        assertEquals(null, relativePath("/foo", "/foo"));
+        assertEquals(null, relativePath("/foo", "/foo/")); // XXX or "/"?   
+        assertEquals("/foo/", relativePath(null, "/foo/"));  
+        assertEquals("/bar", relativePath("/foo", "/foo/bar"));
+        assertEquals("/bar/foo", relativePath("/foo", "/bar/foo"));
+        assertEquals("/bar", relativePath("/foo/", "/foo/bar"));
+        assertEquals("/foobar", relativePath("/foo", "/foobar"));
+    }
+
+    @Test
     public void testConcatOk()
     {
         assertEquals(null, concat(null, null));
@@ -128,7 +142,7 @@ public class UriUtilsTest
         assertEquals("foo..", removeDotSegments("foo.."));
         assertEquals("foo.", removeDotSegments("foo."));
         assertEquals("/.foo", removeDotSegments("/.foo"));
-        assertEquals("/..foo", removeDotSegments("/..foo"));        
+        assertEquals("/..foo", removeDotSegments("/..foo"));
 
         // FELIX-4440
         assertEquals("foo.bar", removeDotSegments("foo.bar"));

Modified: felix/sandbox/http-rfc189/bridge/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/bridge/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/bridge/pom.xml (original)
+++ felix/sandbox/http-rfc189/bridge/pom.xml Wed Jun 25 09:52:05 2014
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Bridge</name>
     <artifactId>org.apache.felix.http.bridge</artifactId>
-    <version>2.3.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <scm>

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

Modified: felix/sandbox/http-rfc189/cometd/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/cometd/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/cometd/pom.xml (original)
+++ felix/sandbox/http-rfc189/cometd/pom.xml Wed Jun 25 09:52:05 2014
@@ -28,7 +28,7 @@
 
     <name>Apache Felix Http Cometd</name>
     <artifactId>org.apache.felix.http.cometd</artifactId>
-    <version>2.3.0-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
     <scm>

Modified: felix/sandbox/http-rfc189/itest/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/pom.xml?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/pom.xml (original)
+++ felix/sandbox/http-rfc189/itest/pom.xml Wed Jun 25 09:52:05 2014
@@ -18,99 +18,90 @@
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>3-SNAPSHOT</version>
-        <relativePath>../parent/pom.xml</relativePath>
-    </parent>
-
-    <name>Apache Felix Http Integration Tests</name>
-    <artifactId>org.apache.felix.http.itest</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-    <packaging>jar</packaging>
-
-    <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/sslfilter</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/http/sslfilter</developerConnection>
-        <url>http://svn.apache.org/viewvc/felix/trunk/http/sslfilter/</url>
-    </scm>
-    
-    <properties>
-    	<felix.http.api.version>2.3.0-SNAPSHOT</felix.http.api.version>
-		<pax.exam.version>2.4.0</pax.exam.version>
-		<pax.exam.plugin.version>1.2.4</pax.exam.plugin.version>
-		<pax.url.aether.version>1.4.0</pax.url.aether.version>
-		<pax.swissbox.version>1.3.1</pax.swissbox.version>
-		<pax.runner.version>1.7.6</pax.runner.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.compendium</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.http.api</artifactId>
-            <version>${felix.http.api.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.http.servlet-api</artifactId>
-            <version>0.0.1-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.http.jetty</artifactId>
-            <version>${felix.http.api.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.felix</groupId>
-            <artifactId>org.apache.felix.configadmin</artifactId>
-            <version>1.8.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.8.2</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <version>1.8.2</version>
-            <scope>test</scope>
-        </dependency>
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.felix</groupId>
+		<artifactId>org.apache.felix.http.parent</artifactId>
+		<version>3-SNAPSHOT</version>
+		<relativePath>../parent/pom.xml</relativePath>
+	</parent>
+
+	<name>Apache Felix Http Integration Tests</name>
+	<artifactId>org.apache.felix.http.itest</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>jar</packaging>
+
+	<scm>
+		<connection>scm:svn:http://svn.apache.org/repos/asf/felix/trunk/http/sslfilter</connection>
+		<developerConnection>scm:svn:https://svn.apache.org/repos/asf/felix/trunk/http/sslfilter</developerConnection>
+		<url>http://svn.apache.org/viewvc/felix/trunk/http/sslfilter/</url>
+	</scm>
+
+	<properties>
+		<felix.http.api.version>3.0.0-SNAPSHOT</felix.http.api.version>
+		<pax.exam.version>3.4.0</pax.exam.version>
+		<pax.url.aether.version>1.6.0</pax.url.aether.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>javax.servlet-api</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.core</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.compendium</artifactId>
+			<scope>provided</scope>
+		</dependency>
 		<dependency>
-			<groupId>org.ops4j.pax.exam</groupId>
-			<artifactId>pax-exam-junit4</artifactId>
-			<version>${pax.exam.version}</version>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.http.api</artifactId>
+			<version>${felix.http.api.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.http.servlet-api</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.http.jetty</artifactId>
+			<version>${felix.http.api.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.configadmin</artifactId>
+			<version>1.8.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.8.2</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mockito</groupId>
+			<artifactId>mockito-all</artifactId>
+			<version>1.8.2</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.ops4j.pax.exam</groupId>
-			<artifactId>pax-exam-container-forked</artifactId>
+			<artifactId>pax-exam-junit4</artifactId>
 			<version>${pax.exam.version}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>org.ops4j.pax.runner</groupId>
-			<artifactId>pax-runner-no-jcl</artifactId>
-			<version>${pax.runner.version}</version>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam-container-native</artifactId>
+			<version>${pax.exam.version}</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
@@ -138,24 +129,18 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>javax.inject</groupId>
-			<artifactId>javax.inject</artifactId>
-			<version>1</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.framework</artifactId>
-			<version>4.0.2</version>
+			<version>3.2.2</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-simple</artifactId>
-			<version>1.6.0</version>
-			<scope>compile</scope>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.6.1</version>
+			<scope>test</scope>
 		</dependency>
-    </dependencies>
+	</dependencies>
 
 	<build>
 		<plugins>
@@ -167,23 +152,18 @@
 					<source>1.6</source>
 				</configuration>
 			</plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                <extensions>true</extensions>
-            </plugin>
-            <plugin>
-                <groupId>org.ops4j.pax.exam</groupId>
-                <artifactId>maven-paxexam-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>generate-config</id>
-                        <goals>
-                            <goal>generate-depends-file</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
+			<plugin>
+				<groupId>org.ops4j.pax.exam</groupId>
+				<artifactId>maven-paxexam-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>generate-config</id>
+						<goals>
+							<goal>generate-depends-file</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
 		</plugins>
 	</build>
 

Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java (original)
+++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/AsyncTest.java Wed Jun 25 09:52:05 2014
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.felix.http.itest;
 
 import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
@@ -35,12 +34,12 @@ 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;
 
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
 public class AsyncTest extends BaseIntegrationTest
 {
 

Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java (original)
+++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java Wed Jun 25 09:52:05 2014
@@ -25,11 +25,11 @@ import static org.ops4j.pax.exam.Constan
 import static org.ops4j.pax.exam.Constants.START_LEVEL_TEST_BUNDLE;
 import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackage;
 import static org.ops4j.pax.exam.CoreOptions.cleanCaches;
-import static org.ops4j.pax.exam.CoreOptions.felix;
 import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.CoreOptions.url;
 
 import java.io.Closeable;
@@ -59,9 +59,10 @@ import javax.servlet.http.HttpServletRes
 import org.apache.felix.http.api.ExtHttpService;
 import org.junit.After;
 import org.junit.Before;
-import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -78,6 +79,7 @@ import org.osgi.util.tracker.ServiceTrac
  *
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
+@ExamReactorStrategy(PerClass.class)
 public abstract class BaseIntegrationTest
 {
     protected static class TestFilter implements Filter
@@ -305,14 +307,10 @@ public abstract class BaseIntegrationTes
     public Option[] config()
     {
         return options(
-            bootDelegationPackage("sun.*"),
-            cleanCaches(),
-            CoreOptions.systemProperty("logback.configurationFile").value("file:src/test/resources/logback.xml"), //
-//            CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8787"),
+            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN"),
 
-            mavenBundle("org.slf4j", "slf4j-api").version("1.6.5").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("ch.qos.logback", "logback-core").version("1.0.6").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("ch.qos.logback", "logback-classic").version("1.0.6").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            cleanCaches(),
+            bootDelegationPackage("sun.*"),
 
             url("link:classpath:META-INF/links/org.ops4j.pax.exam.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
             url("link:classpath:META-INF/links/org.ops4j.pax.exam.inject.link").startLevel(START_LEVEL_SYSTEM_BUNDLES),
@@ -329,7 +327,8 @@ public abstract class BaseIntegrationTes
             mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY).versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
             mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject().startLevel(START_LEVEL_SYSTEM_BUNDLES),
 
-            junitBundles(), frameworkStartLevel(START_LEVEL_TEST_BUNDLE), felix());
+            junitBundles(), 
+            frameworkStartLevel(START_LEVEL_TEST_BUNDLE));
     }
 
     @Before

Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java (original)
+++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/EventListenerTest.java Wed Jun 25 09:52:05 2014
@@ -18,8 +18,9 @@
  */
 package org.apache.felix.http.itest;
 
-import static javax.servlet.http.HttpServletResponse.*;
-import static org.junit.Assert.*;
+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;
@@ -37,7 +38,7 @@ import javax.servlet.http.HttpSessionLis
 
 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.framework.ServiceRegistration;
 
 /**
@@ -45,7 +46,7 @@ import org.osgi.framework.ServiceRegistr
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
 public class EventListenerTest extends BaseIntegrationTest
 {
     /**

Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java (original)
+++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyConnectorTest.java Wed Jun 25 09:52:05 2014
@@ -29,13 +29,13 @@ import org.eclipse.jetty.server.Abstract
 import org.eclipse.jetty.server.Connector;
 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.framework.ServiceRegistration;
 
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@RunWith(JUnit4TestRunner.class)
+@RunWith(PaxExam.class)
 public class HttpJettyConnectorTest extends BaseIntegrationTest
 {
     @Test

Modified: felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java?rev=1605310&r1=1605309&r2=1605310&view=diff
==============================================================================
--- felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java (original)
+++ felix/sandbox/http-rfc189/itest/src/test/java/org/apache/felix/http/itest/HttpJettyTest.java Wed Jun 25 09:52:05 2014
@@ -50,14 +50,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.framework.Bundle;
 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 HttpJettyTest extends BaseIntegrationTest
 {
 



Mime
View raw message