ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1731866 [1/2] - in /ace/trunk: org.apache.ace.authentication.itest/ org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ org.apache.ace.bnd/ org.apache.ace.bnd/services/ org.apache.ace.bnd/src/org/apache/ace/bnd/regist...
Date Tue, 23 Feb 2016 14:39:56 GMT
Author: jawi
Date: Tue Feb 23 14:39:54 2016
New Revision: 1731866

URL: http://svn.apache.org/viewvc?rev=1731866&view=rev
Log:
ACE-532 - use more R6 whiteboard goodies:

- simplify the authentication configuration: instead of configuring it per
  endpoint, use a single servlet context helper that only needs a single
  configuration. Patch supplied by @brampouwelse;
- fix the itests to include the new servlet context helper;
- Clean up the remnants of the old endpoint configuration parts that was
  lingering around after all the changes for ACE-532;
- fix up a couple of license headers where missing.


Added:
    ace/trunk/org.apache.ace.http/api.bnd
    ace/trunk/org.apache.ace.http/context.bnd
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/package-info.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AceWebuiServletContextHelper.java
    ace/trunk/run-client/conf/org.apache.ace.http.context.cfg
    ace/trunk/run-obr/conf/org.apache.ace.http.context.cfg
    ace/trunk/run-relay/conf/org.apache.ace.http.context.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.connectionfactory/server.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.http.context.cfg
    ace/trunk/run-server/conf/org.apache.ace.http.context.cfg
Removed:
    ace/trunk/org.apache.ace.http.itest/
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinResourceHandler.java
    ace/trunk/run-client/conf/org.apache.ace.gogo.servlet.cfg
    ace/trunk/run-obr/conf/org.apache.ace.obr.servlet.cfg
    ace/trunk/run-relay/conf/org.apache.ace.deployment.servlet.cfg
    ace/trunk/run-relay/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.configurator.useradmin.task.UpdateUserAdminTask.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.deployment.servlet.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.gogo.servlet.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.obr.servlet.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
    ace/trunk/run-server/conf/org.apache.ace.deployment.servlet.cfg
    ace/trunk/run-server/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg
    ace/trunk/run-server/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
Modified:
    ace/trunk/org.apache.ace.authentication.itest/bnd.bnd
    ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
    ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java
    ace/trunk/org.apache.ace.bnd/registry.bnd
    ace/trunk/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory
    ace/trunk/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java
    ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd
    ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
    ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java
    ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java
    ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java
    ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
    ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd
    ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
    ace/trunk/org.apache.ace.client.rest/bnd.bnd
    ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java
    ace/trunk/org.apache.ace.deployment.itest/bnd.bnd
    ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
    ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java
    ace/trunk/org.apache.ace.deployment/bnd.bnd
    ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java
    ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
    ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
    ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd
    ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java
    ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java
    ace/trunk/org.apache.ace.http/bnd.bnd
    ace/trunk/org.apache.ace.log.itest/bnd.bnd
    ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java
    ace/trunk/org.apache.ace.log/bnd.bnd
    ace/trunk/org.apache.ace.log/server.servlet.bnd
    ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java
    ace/trunk/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java
    ace/trunk/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
    ace/trunk/org.apache.ace.obr/bnd.bnd
    ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/servlet/Activator.java
    ace/trunk/org.apache.ace.obr/src/org/apache/ace/obr/servlet/BundleServlet.java
    ace/trunk/org.apache.ace.repository.itest/bnd.bnd
    ace/trunk/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java
    ace/trunk/org.apache.ace.repository/bnd.bnd
    ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/servlet/Activator.java
    ace/trunk/org.apache.ace.repository/src/org/apache/ace/repository/servlet/RepositoryServletBase.java
    ace/trunk/org.apache.ace.useradmin.itest/bnd.bnd
    ace/trunk/org.apache.ace.useradmin.itest/src/org/apache/ace/it/useradmin/UserAdminRepositoryTest.java
    ace/trunk/org.apache.ace.useradmin/test/aceDefault.xml
    ace/trunk/org.apache.ace.useradmin/test/current.xml
    ace/trunk/org.apache.ace.useradmin/test/org/apache/ace/useradmin/repository/xstream/XStreamTest.java
    ace/trunk/org.apache.ace.useradmin/test/valid.xml
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java
    ace/trunk/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java
    ace/trunk/run-client/client.bndrun
    ace/trunk/run-client/conf/org.apache.ace.client.rest.cfg
    ace/trunk/run-client/conf/org.apache.ace.useradmin.repository.cfg
    ace/trunk/run-client/conf/org.apache.ace.webui.vaadin.cfg
    ace/trunk/run-obr/conf/org.apache.ace.useradmin.repository.cfg
    ace/trunk/run-obr/obr.bndrun
    ace/trunk/run-relay/conf/org.apache.ace.deployment.servlet.agent.cfg
    ace/trunk/run-relay/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
    ace/trunk/run-relay/conf/org.apache.ace.useradmin.repository.cfg
    ace/trunk/run-relay/relay.bndrun
    ace/trunk/run-server-allinone/conf/org.apache.ace.client.rest.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.deployment.servlet.agent.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.http.redirector.factory/root-to-ace.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.useradmin.repository.cfg
    ace/trunk/run-server-allinone/conf/org.apache.ace.webui.vaadin.cfg
    ace/trunk/run-server-allinone/server-allinone.bndrun
    ace/trunk/run-server/conf/org.apache.ace.deployment.servlet.agent.cfg
    ace/trunk/run-server/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
    ace/trunk/run-server/conf/org.apache.ace.useradmin.repository.cfg
    ace/trunk/run-server/server.bndrun

Modified: ace/trunk/org.apache.ace.authentication.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication.itest/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.authentication.itest/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -65,7 +65,8 @@ Test-Cases: ${classes;CONCRETE;NAMED;*Te
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.log.api;version=latest,\
 	org.apache.ace.feedback.common;version=latest,\
-	org.apache.ace.useradmin.repository
+	org.apache.ace.useradmin.repository;version=latest,\
+	org.apache.ace.http.context;version=latest
 	
 Private-Package: org.apache.ace.it.authentication
 Bundle-Version: 1.0.0

Modified: ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java (original)
+++ ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java Tue Feb 23 14:39:54 2016
@@ -18,8 +18,6 @@
  */
 package org.apache.ace.it.authentication;
 
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -51,7 +49,6 @@ import org.osgi.service.useradmin.UserAd
  * and we check if it is indeed replicated to the server.
  */
 public class LogAuthenticationTest extends AuthenticationTestBase {
-
     private static final String AUDITLOG_ENDPOINT = "/auditlog";
 
     private static final String HOST = "localhost";
@@ -90,7 +87,7 @@ public class LogAuthenticationTest exten
         try {
             String baseURL = "http://" + HOST + ":" + TestConstants.PORT;
             URL testURL = new URL(baseURL.concat(AUDITLOG_ENDPOINT));
-            assertTrue("Failed to access auditlog in time!", waitForURL(m_connectionFactory, testURL, 401, 15000));
+            assertTrue("Failed to access auditlog in time!", waitForURL(m_connectionFactory, testURL, 403, 15000));
 
             String userName = "d";
             String password = "f";
@@ -141,11 +138,11 @@ public class LogAuthenticationTest exten
         configureFactory("org.apache.ace.target.log.sync.factory",
             "name", "auditlog");
         configureFactory("org.apache.ace.log.server.servlet.factory",
-            "name", "auditlog",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, AUDITLOG_ENDPOINT.concat("/*"),
-            "authentication.enabled", "true");
+            "name", "auditlog", "endpoint", AUDITLOG_ENDPOINT);
         configureFactory("org.apache.ace.log.server.store.factory",
             "name", "auditlog");
+
+        configure("org.apache.ace.http.context", "authentication.enabled", "true");
     }
 
     @Override

Modified: ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java (original)
+++ ace/trunk/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java Tue Feb 23 14:39:54 2016
@@ -19,8 +19,6 @@
 
 package org.apache.ace.it.authentication;
 
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -98,31 +96,21 @@ public class ObrAuthenticationTest exten
             RepositoryConstants.REPOSITORY_NAME, "users",
             RepositoryConstants.REPOSITORY_CUSTOMER, "apache",
             RepositoryConstants.REPOSITORY_MASTER, "true");
-        
-        configure("org.apache.ace.repository.servlet.RepositoryServlet",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/repository/*", 
-            "authentication.enabled", "false");
 
         configure("org.apache.ace.useradmin.repository",
             "repositoryLocation", "http://localhost:" + TestConstants.PORT + "/repository",
             "repositoryCustomer", "apache",
             "repositoryName", "users");
-        
-        configure("org.apache.ace.log.server.store.filebased", "MaxEvents", "0");
-        
 
-        configure("org.apache.ace.obr.servlet",
-            "OBRInstance", "singleOBRServlet",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, m_endpoint.concat("/*"),
-            "authentication.enabled", "true");
+        configure("org.apache.ace.log.server.store.filebased", "MaxEvents", "0");
 
         m_obrURL = new URL("http://localhost:" + TestConstants.PORT + m_endpoint + "/");
 
         configure("org.apache.ace.client.repository", "obrlocation", m_obrURL.toExternalForm());
 
-        configure("org.apache.ace.obr.storage.file",
-            "OBRInstance", "singleOBRStore",
-            OBRFileStoreConstants.FILE_LOCATION_KEY, fileLocation);
+        configure("org.apache.ace.obr.storage.file", OBRFileStoreConstants.FILE_LOCATION_KEY, fileLocation);
+
+        configure("org.apache.ace.http.context", "authentication.enabled", "true");
     }
 
     @Override
@@ -132,10 +120,10 @@ public class ObrAuthenticationTest exten
             String password = "f";
             importSingleUser(m_userRepository, userName, password);
             waitForUser(m_userAdmin, userName);
-            
-            URL testURL = new URL(m_obrURL, "index.xml");            
-            
-            assertTrue("Failed to access OBR in time!", waitForURL(m_connectionFactory, testURL, 401, 15000));
+
+            URL testURL = new URL(m_obrURL, "index.xml");
+
+            assertTrue("Failed to access OBR in time!", waitForURL(m_connectionFactory, testURL, 403, 15000));
 
             m_authConfigPID = configureFactory("org.apache.ace.connectionfactory",
                 "authentication.baseURL", m_obrURL.toExternalForm(),
@@ -228,7 +216,7 @@ public class ObrAuthenticationTest exten
             assertNotNull(conn);
 
             // we expect a 401 for this URL...
-            NetUtils.waitForURL(url, 401, 15000);
+            NetUtils.waitForURL(url, 401, 5000);
 
             try {
                 // ...causing all other methods on URLConnection to fail...

Modified: ace/trunk/org.apache.ace.bnd/registry.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.bnd/registry.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.bnd/registry.bnd (original)
+++ ace/trunk/org.apache.ace.bnd/registry.bnd Tue Feb 23 14:39:54 2016
@@ -1,2 +1,4 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
 Bundle-Version: 1.0.0
 Export-Package: org.apache.ace.bnd.registry
\ No newline at end of file

Modified: ace/trunk/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory (original)
+++ ace/trunk/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory Tue Feb 23 14:39:54 2016
@@ -1 +1,3 @@
-org.apache.ace.connectionfactory.impl.ConnectionFactoryImpl
\ No newline at end of file
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
+org.apache.ace.connectionfactory.impl.ConnectionFactoryImpl

Modified: ace/trunk/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java (original)
+++ ace/trunk/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java Tue Feb 23 14:39:54 2016
@@ -1,3 +1,21 @@
+/*
+ * 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.ace.bnd.registry;
 
 import java.util.ArrayList;

Modified: ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -67,7 +67,9 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.ace.client.repository.helper.bundle;version=latest,\
 	org.apache.ace.client.repository.helper.configuration;version=latest,\
 	org.apache.ace.client.repository.impl;version=latest,\
-	org.apache.ace.feedback.common;version=latest
+	org.apache.ace.feedback.common;version=latest,\
+	org.apache.ace.http.context;version=latest
+	
 -runproperties: \
 	org.apache.felix.eventadmin.Timeout=0,\
 	org.apache.felix.log.storeDebug=true,\

Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java Tue Feb 23 14:39:54 2016
@@ -18,8 +18,6 @@
  */
 package org.apache.ace.it.repositoryadmin;
 
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
-
 import java.io.IOException;
 import java.net.ConnectException;
 import java.net.HttpURLConnection;
@@ -110,7 +108,7 @@ public abstract class BaseRepositoryAdmi
         }
     }
 
-    protected static final String ENDPOINT_NAME = "/AdminRepTest";
+    protected static final String ENDPOINT_NAME = "/repository";
     protected static final String HOST = "http://localhost:" + TestConstants.PORT;
 
     protected URL m_endpoint;
@@ -136,11 +134,8 @@ public abstract class BaseRepositoryAdmi
         m_obrURL = new URL(baseURL);
 
         configure("org.apache.ace.client.repository", "obrlocation", m_obrURL.toExternalForm());
-        configure("org.apache.ace.obr.servlet", 
-            "OBRInstance", "singleOBRServlet", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, endpoint.concat("/*"), 
-            "authentication.enabled", "false");
-        configure("org.apache.ace.obr.storage.file", "OBRInstance", "singleOBRStore", OBRFileStoreConstants.FILE_LOCATION_KEY, fileLocation);
+
+        configure("org.apache.ace.obr.storage.file", OBRFileStoreConstants.FILE_LOCATION_KEY, fileLocation);
 
         // Wait for the endpoint to respond.
         URL repoURL = new URL(baseURL + "index.xml");
@@ -192,8 +187,9 @@ public abstract class BaseRepositoryAdmi
 
         configure("org.apache.ace.log.server.store.filebased", "MaxEvents", "0");
 
-        configureFactory("org.apache.ace.log.server.store.factory",
-            "name", "auditlog", "authentication.enabled", "false");
+        configureFactory("org.apache.ace.log.server.store.factory", "name", "auditlog");
+
+        configure("org.apache.ace.http.context", "authentication.enabled", "false");
     }
 
     protected final void cleanUp() throws InvalidSyntaxException, InterruptedException {
@@ -305,31 +301,6 @@ public abstract class BaseRepositoryAdmi
         return user;
     }
 
-    protected void deleteObr(String endpoint) throws IOException, InvalidSyntaxException, InterruptedException {
-        // This is a little ugly: we cannot just delete the configuration, since that will result in a
-        // sharing violation between this bundle and the servlet bundle. In stead, we make the servlet
-        // use an invalid endpoint.
-        Dictionary<String, Object> propsServlet = new Hashtable<>();
-        propsServlet.put(HTTP_WHITEBOARD_SERVLET_PATTERN, endpoint + "invalid");
-        propsServlet.put("OBRInstance", "singleOBRServlet");
-        propsServlet.put("authentication.enabled", "false");
-        Configuration configServlet = m_configAdmin.getConfiguration("org.apache.ace.obr.servlet");
-
-        configServlet.update(propsServlet);
-
-        URL url = new URL("http://localhost:" + TestConstants.PORT + "/" + endpoint + "/index.xml");
-        int response = ((HttpURLConnection) url.openConnection()).getResponseCode();
-        int tries = 0;
-        while ((response != 404) && (tries < 50)) {
-            Thread.sleep(100); // If we get interrupted, there will be a good reason for it.
-            response = ((HttpURLConnection) url.openConnection()).getResponseCode();
-            tries++;
-        }
-        if (tries == 50) {
-            throw new IOException("The OBR servlet does not want to go away. Last response code: " + response);
-        }
-    }
-
     protected Component[] getDependencies() {
         return new Component[] {
             createComponent()
@@ -353,7 +324,7 @@ public abstract class BaseRepositoryAdmi
     protected <T> T runAndWaitForEvent(Callable<T> callable, final boolean debug, final String... topicList) throws Exception {
         return runAndWaitForEvent(callable, debug, null, topicList);
     }
-    
+
     protected <T> T runAndWaitForEvent(Callable<T> callable, final boolean debug, final List<Event> events, final String... topicList) throws Exception {
         Dictionary<String, Object> topics = new Hashtable<>();
         topics.put(EventConstants.EVENT_TOPIC, topicList);
@@ -382,12 +353,12 @@ public abstract class BaseRepositoryAdmi
                 }
             });
         comp.add(new ComponentStateListener() {
-			@Override
-			public void changed(Component component, ComponentState state) {
-				if (state == ComponentState.TRACKING_OPTIONAL) {
-					startLatch.countDown();
-				}
-			}
+            @Override
+            public void changed(Component component, ComponentState state) {
+                if (state == ComponentState.TRACKING_OPTIONAL) {
+                    startLatch.countDown();
+                }
+            }
         });
 
         if (debug) {
@@ -434,13 +405,6 @@ public abstract class BaseRepositoryAdmi
         }
     }
 
-    protected void startRepositoryService() throws IOException {
-        // configure the (replication)repository servlets
-        configure("org.apache.ace.repository.servlet.RepositoryServlet", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, ENDPOINT_NAME.concat("/*"), 
-            "authentication.enabled", "false");
-    }
-
     @Override
     protected void doTearDown() throws Exception {
         try {
@@ -495,15 +459,15 @@ public abstract class BaseRepositoryAdmi
             final Semaphore sem = new Semaphore(0);
 
             ServiceTracker<Repository, Repository> tracker = new ServiceTracker<Repository, Repository>(m_bundleContext, Repository.class, null) {
-                    @Override
-                    public void removedService(ServiceReference<Repository> reference, Repository service) {
-                        super.removedService(reference, service);
-                        // config.length times two because the service tracker also sees added events for each instance
-                        if (size() == 0) {
-                            sem.release();
-                        }
+                @Override
+                public void removedService(ServiceReference<Repository> reference, Repository service) {
+                    super.removedService(reference, service);
+                    // config.length times two because the service tracker also sees added events for each instance
+                    if (size() == 0) {
+                        sem.release();
                     }
-                };
+                }
+            };
             tracker.open();
 
             for (int i = 0; i < configs.length; i++) {

Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java Tue Feb 23 14:39:54 2016
@@ -44,8 +44,6 @@ public class ClientAutomationTest extend
      * to do with this operator.
      */
     public void testAutoTargetOperator() throws Exception {
-        startRepositoryService();
-        
         createTestUser();
 
         addRepository("storeInstance", "apache", "store", true);

Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java Tue Feb 23 14:39:54 2016
@@ -139,8 +139,6 @@ public class RepositoryAdminTest extends
     public void testAutoApprove() throws Exception {
         User user = new MockUser();
 
-        startRepositoryService();
-
         addRepository("storeInstance", "apache", "store", true);
         addRepository("targetInstance", "apache", "target", true);
         addRepository("deploymentInstance", "apache", "deployment", true);
@@ -165,9 +163,8 @@ public class RepositoryAdminTest extends
             }
         }, false, TargetObject.TOPIC_ADDED, TOPIC_ADDED);
 
-        final StatefulTargetObject sgo =
-            m_statefulTargetRepository.get(
-                m_bundleContext.createFilter("(" + TargetObject.KEY_ID + "=" + "testAutoApproveTarget)")).get(0);
+        final StatefulTargetObject sgo = m_statefulTargetRepository.get(
+            m_bundleContext.createFilter("(" + TargetObject.KEY_ID + "=" + "testAutoApproveTarget)")).get(0);
 
         // Set up some deployment information for the target.
         final FeatureObject g = runAndWaitForEvent(new Callable<FeatureObject>() {
@@ -294,8 +291,6 @@ public class RepositoryAdminTest extends
 
         assertTrue(m_artifactRepository.get().size() == 1);
         assertTrue(m_artifactRepository.getResourceProcessors().size() == 1);
-
-        deleteObr("/obr");
     }
 
     public void testImportArtifactInvalidURL() throws Exception {
@@ -324,8 +319,6 @@ public class RepositoryAdminTest extends
         InvalidSyntaxException {
         User user1 = new MockUser();
 
-        startRepositoryService();
-
         addRepository("storeInstance", "apache", "store", true);
         addRepository("targetInstance", "apache", "target", true);
 
@@ -355,8 +348,6 @@ public class RepositoryAdminTest extends
     public void testReadOnlyRepositoryAccess() throws Exception {
         User user1 = new MockUser();
 
-        startRepositoryService();
-
         addRepository("storeInstance", "apache", "store", true);
         addRepository("targetInstance", "apache", "target", true);
 
@@ -453,8 +444,6 @@ public class RepositoryAdminTest extends
         final User user1 = new MockUser();
         final User user2 = new MockUser();
 
-        startRepositoryService();
-
         addRepository("storeInstance", "apache", "store", true);
         addRepository("targetInstance", "apache", "target", true);
 

Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java Tue Feb 23 14:39:54 2016
@@ -763,8 +763,6 @@ public class StatefulTargetRepositoryTes
         User user = new MockUser();
         String customer = "customer-" + Long.toHexString(System.currentTimeMillis());
 
-        startRepositoryService();
-
         addRepository("storeInstance", customer, "store", true);
         addRepository("targetInstance", customer, "target", true);
         addRepository("deploymentInstance", customer, "deployment", true);

Modified: ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java Tue Feb 23 14:39:54 2016
@@ -303,8 +303,6 @@ public class TemplateProcessorTest exten
     private void setupRepository() throws IOException, InterruptedException, InvalidSyntaxException {
         User user = new MockUser();
 
-        startRepositoryService();
-
         addRepository("storeInstance", "apache", "store", true);
         addRepository("targetInstance", "apache", "target", true);
         addRepository("deploymentInstance", "apache", "deployment", true);
@@ -407,8 +405,6 @@ public class TemplateProcessorTest exten
         inFile = tryGetStringFromURL(findXmlUrlInDeploymentObject(dvo), 10, 100);
 
         assertEquals(xmlHeader + simpleTemplateProcessed + xmlFooter, inFile);
-
-        deleteObr("/obr");
     }
 
     /**

Modified: ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -71,7 +71,9 @@
 	org.apache.ace.deployment.provider.repositorybased;version=latest,\
 	org.apache.ace.client.rest;version=latest,\
 	org.apache.ace.client.workspace;version=latest,\
-	org.apache.ace.feedback.common;version=latest
+	org.apache.ace.feedback.common;version=latest,\
+	org.apache.ace.http.context;version=latest
+
 -runproperties: \
 	org.apache.felix.log.storeDebug=true,\
 	org.apache.felix.eventadmin.Timeout=0,\

Modified: ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java (original)
+++ ace/trunk/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java Tue Feb 23 14:39:54 2016
@@ -33,7 +33,6 @@ import static org.apache.ace.client.rest
 import static org.apache.ace.client.rest.itest.ClientRestUtils.deleteResources;
 import static org.apache.ace.client.rest.itest.ClientRestUtils.ensureCleanStore;
 import static org.apache.ace.test.utils.FileUtils.createEmptyBundle;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
 
 import java.io.File;
 import java.io.IOException;
@@ -368,21 +367,7 @@ public class RESTClientTest extends Inte
             "obrlocation", HOST.concat("/obr/"));
 
         configure("org.apache.ace.client.rest",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/client/*",
-            "repository.url", HOST.concat("/repository"),
-            "authentication.enabled", "false");
-
-        configure("org.apache.ace.deployment.servlet",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/deployment/*",
-            "authentication.enabled", "false");
-
-        configure("org.apache.ace.repository.servlet.RepositoryServlet",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/repository/*",
-            "authentication.enabled", "false");
-
-        configure("org.apache.ace.obr.servlet",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/obr/*",
-            "authentication.enabled", "false");
+            "repository.url", HOST.concat("/repository"));
 
         configure("org.apache.ace.obr.storage.file",
             "fileLocation", STOREPATH);
@@ -408,9 +393,7 @@ public class RESTClientTest extends Inte
             "deployment.repository.name", "deployment");
 
         configureFactory("org.apache.ace.log.server.servlet.factory",
-            "name", "auditlog",
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/auditlog/*",
-            "authentication.enabled", "false");
+            "name", "auditlog", "endpoint", "/auditlog");
 
         configureFactory("org.apache.ace.log.server.store.factory",
             "name", "auditlog");
@@ -440,6 +423,7 @@ public class RESTClientTest extends Inte
             "customer", "apache",
             "master", "true");
 
+        configure("org.apache.ace.http.context", "authentication.enabled", "false");
     }
 
     /** Create a user so we can log in to the server. */

Modified: ace/trunk/org.apache.ace.client.rest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.rest/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -5,6 +5,7 @@
 	${testng},\
 	osgi.core;version=6.0.0,\
 	osgi.cmpn,\
+	org.apache.felix.http.api,\
 	org.apache.felix.http.servlet-api,\
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.client.repository.api;version=latest,\
@@ -15,7 +16,8 @@
 	org.apache.felix.gogo.runtime,\
 	org.apache.ace.feedback.common;version=latest,\
 	org.apache.ace.client.workspace;version=latest,\
-	org.apache.ace.test;version=latest
+	org.apache.ace.test;version=latest,\
+	org.apache.ace.http.api;version=latest
 
 Private-Package: \
 	org.apache.ace.client.rest,\

Modified: ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java (original)
+++ ace/trunk/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java Tue Feb 23 14:39:54 2016
@@ -18,6 +18,13 @@
  */
 package org.apache.ace.client.rest;
 
+import static org.apache.ace.http.HttpConstants.ACE_WHITEBOARD_CONTEXT_SELECT_FILTER;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_LISTENER;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
+
+import java.util.Properties;
+
 import javax.servlet.Servlet;
 import javax.servlet.http.HttpSessionListener;
 
@@ -29,28 +36,24 @@ import org.osgi.service.log.LogService;
 
 public class Activator extends DependencyActivatorBase {
     public static final String RESTCLIENT_PID = "org.apache.ace.client.rest";
-    
+
     @Override
     public void init(BundleContext context, DependencyManager manager) throws Exception {
+        Properties props = new Properties();
+        props.put(HTTP_WHITEBOARD_SERVLET_PATTERN, "/client/*");
+        props.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WHITEBOARD_CONTEXT_SELECT_FILTER);
+        props.put(HTTP_WHITEBOARD_LISTENER, true);
+
         manager.add(createComponent()
-            .setInterface(new String[] { Servlet.class.getName(), HttpSessionListener.class.getName() }, null)
+            .setInterface(new String[] { Servlet.class.getName(), HttpSessionListener.class.getName() }, props)
             .setImplementation(RESTClientServlet.class)
             .add(createServiceDependency()
                 .setService(WorkspaceManager.class)
-                .setRequired(true)
-            )
+                .setRequired(true))
             .add(createConfigurationDependency()
-                .setPropagate(true)
-                .setPid(RESTCLIENT_PID)
-            )
+                .setPid(RESTCLIENT_PID))
             .add(createServiceDependency()
                 .setService(LogService.class)
-                .setRequired(false)
-            )
-        );
-    }
-
-    @Override
-    public void destroy(BundleContext context, DependencyManager manager) throws Exception {
+                .setRequired(false)));
     }
 }

Modified: ace/trunk/org.apache.ace.deployment.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.deployment.itest/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -61,7 +61,9 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.ace.scheduler.impl;version=latest,\
 	org.apache.ace.scheduler.api;version=latest,\
 	org.apache.ace.test;version=latest,\
-	org.apache.ace.range.api;version=latest
+	org.apache.ace.range.api;version=latest,\
+	org.apache.ace.http.context;version=latest
+	
 Private-Package: \
 	org.apache.ace.it.deployment,\
 	org.apache.ace.deployment.util.test,\

Modified: ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java (original)
+++ ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java Tue Feb 23 14:39:54 2016
@@ -22,7 +22,6 @@ import static org.apache.ace.it.deployme
 import static org.apache.ace.it.deployment.Constants.TEST_CUSTOMER;
 import static org.apache.ace.it.deployment.Constants.TEST_HTTP_PORT;
 import static org.apache.ace.it.deployment.Constants.TEST_TARGETID;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
 
 import java.io.File;
 import java.net.URL;
@@ -65,9 +64,6 @@ public class Ace330Test extends Integrat
         String repoLocation = m_repoLocation.toExternalForm();
         String obrLocation = m_obrLocation.toExternalForm();
 
-        // configureFactory("org.apache.ace.log.server.servlet.factory", "name", "auditlog",
-        // HTTP_WHITEBOARD_SERVLET_PATTERN, "/auditlog/*", "authentication.enabled", "false");
-        // configureFactory("org.apache.ace.log.server.store.factory", "name", "auditlog");
         // the various repositories...
         configureFactory("org.apache.ace.server.repository.factory", "name", "deployment", "customer", TEST_CUSTOMER, "master", "true");
         configureFactory("org.apache.ace.server.repository.factory", "name", "shop", "customer", TEST_CUSTOMER, "master", "true");
@@ -76,38 +72,23 @@ public class Ace330Test extends Integrat
 
         configure("org.apache.ace.client.repository", "showunregisteredtargets", "true", "deploymentversionlimit", "3", "obrlocation", obrLocation);
         configure("org.apache.ace.client.rest", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/client/*", 
             "repository.url", repoLocation, 
-            "authentication.enabled", "false",
             "customer.name", TEST_CUSTOMER, 
             "store.repository.name", "shop",
             "distribution.repository.name", "target", 
             "deployment.repository.name", "deployment");
 
         configure("org.apache.ace.deployment.provider.repositorybased", "url", repoLocation, "name", "deployment", "customer", TEST_CUSTOMER);
-        configure("org.apache.ace.deployment.servlet", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/deployment/*", 
-            "authentication.enabled", "false");
         configure("org.apache.ace.deployment.servlet.agent", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/agent/*", 
-            "obr.url", obrLocation, 
-            "authentication.enabled", "false");
+            "obr.url", obrLocation);
 
         configure("org.apache.ace.discovery.property", "serverURL", m_host);
-        configure("org.apache.ace.identification.property", "targetID", TEST_TARGETID);
 
-        configure("org.apache.ace.obr.servlet", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/obr/*", 
-            "authentication.enabled", "false");
+        configure("org.apache.ace.identification.property", "targetID", TEST_TARGETID);
         
         configure("org.apache.ace.obr.storage.file", "fileLocation", m_obrStorePath);
 
-        configure("org.apache.ace.repository.servlet.RepositoryReplicationServlet", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/replication/*", 
-            "authentication.enabled", "false");
-        configure("org.apache.ace.repository.servlet.RepositoryServlet", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/repository/*", 
-            "authentication.enabled", "false");
+        configure("org.apache.ace.http.context", "authentication.enabled", "false");
     }
 
     @Override

Modified: ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java (original)
+++ ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java Tue Feb 23 14:39:54 2016
@@ -18,8 +18,6 @@
  */
 package org.apache.ace.it.deployment;
 
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
-
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -302,13 +300,11 @@ public class DeploymentIntegrationTest e
     }
 
     private void configureServer() throws IOException {
-        // configure data bundle
-        configure("org.apache.ace.deployment.servlet", 
-            HTTP_WHITEBOARD_SERVLET_PATTERN, "/deployment/*", 
-            "authentication.enabled", "false");
         // configure file based backend
         configure("org.apache.ace.deployment.provider.filebased", 
             "BaseDirectoryName", m_tempDir.getAbsolutePath());
+
+        configure("org.apache.ace.http.context", "authentication.enabled", "false");
     }
 
     private void configureTarget() throws IOException {

Modified: ace/trunk/org.apache.ace.deployment/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.deployment/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -18,5 +18,6 @@
 	org.apache.ace.scheduler.api;version=latest,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.range.api;version=latest,\
+	org.apache.ace.http.api;version=latest,\
 	org.easymock
 -sub: *.bnd

Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java (original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java Tue Feb 23 14:39:54 2016
@@ -18,7 +18,10 @@
  */
 package org.apache.ace.deployment.servlet;
 
+import static org.apache.ace.http.HttpConstants.ACE_WHITEBOARD_CONTEXT_SELECT_FILTER;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT;
 import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_PATTERN;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
 
 import java.util.Properties;
 
@@ -35,38 +38,41 @@ import org.osgi.framework.BundleContext;
 import org.osgi.service.log.LogService;
 
 public class Activator extends DependencyActivatorBase {
-    public static final String DEPLOYMENT_PID = "org.apache.ace.deployment.servlet";
     public static final String AGENT_PID = "org.apache.ace.deployment.servlet.agent";
 
     @Override
     public void init(BundleContext context, DependencyManager manager) throws Exception {
+        Properties deploymentServletProps = new Properties();
+        deploymentServletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, "/deployment/*");
+        deploymentServletProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WHITEBOARD_CONTEXT_SELECT_FILTER);
+        
         manager.add(createComponent()
-            .setInterface(Servlet.class.getName(), null)
+            .setInterface(Servlet.class.getName(), deploymentServletProps)
             .setImplementation(DeploymentServlet.class)
-            .add(createConfigurationDependency().setPropagate(true).setPid(DEPLOYMENT_PID))
             .add(createServiceDependency().setService(StreamGenerator.class).setRequired(true))
             .add(createServiceDependency().setService(DeploymentProvider.class).setRequired(true))
             .add(createServiceDependency().setService(DeploymentProcessor.class).setRequired(false).setCallbacks("addProcessor", "removeProcessor"))
             .add(createServiceDependency().setService(LogService.class).setRequired(false))
         );
+         
+        Properties agentServletProps = new Properties();
+        agentServletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, "/agent/*");
+        agentServletProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WHITEBOARD_CONTEXT_SELECT_FILTER);
+        
         manager.add(createComponent()
-            .setInterface(Servlet.class.getName(), null)
+            .setInterface(Servlet.class.getName(), agentServletProps)
             .setImplementation(AgentDeploymentServlet.class)
-            .add(createConfigurationDependency().setPropagate(true).setPid(AGENT_PID))
+            .add(createConfigurationDependency().setPid(AGENT_PID))
             .add(createServiceDependency().setService(ConnectionFactory.class).setRequired(true))
             .add(createServiceDependency().setService(LogService.class).setRequired(false))
         );
         
-        Properties props = new Properties();
-        props.put(HTTP_WHITEBOARD_FILTER_PATTERN, "/*");
+        Properties filterProps = new Properties();
+        filterProps.put(HTTP_WHITEBOARD_FILTER_PATTERN, "/*");
         manager.add(createComponent()
             .setInterface(Filter.class.getName(), null)
             .setImplementation(OverloadedFilter.class)
         );
     }
 
-    @Override
-    public void destroy(BundleContext context, DependencyManager manager) throws Exception {
-        // do nothing
-    }
 }
\ No newline at end of file

Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java (original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java Tue Feb 23 14:39:54 2016
@@ -18,8 +18,6 @@
  */
 package org.apache.ace.deployment.servlet;
 
-import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
-
 import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
@@ -42,24 +40,21 @@ import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 
-import org.apache.ace.authentication.api.AuthenticationService;
 import org.apache.ace.connectionfactory.ConnectionFactory;
-import org.apache.felix.dm.Component;
-import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.Version;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
 import org.osgi.service.log.LogService;
-import org.osgi.service.useradmin.User;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 
 public class AgentDeploymentServlet extends HttpServlet implements ManagedService {
+    private static final long serialVersionUID = 1L;
+
     private static final int BUFFER_SIZE = 1024 * 32;
-    /** A boolean denoting whether or not authentication is enabled. */
-    private static final String KEY_USE_AUTHENTICATION = "authentication.enabled";
+
     /** URL to the OBR that is used for finding versions of the agent. */
     private static final String KEY_OBR_URL = "obr.url";
 
@@ -70,12 +65,9 @@ public class AgentDeploymentServlet exte
     public static final String TEXT_MIMETYPE = "text/plain";
 
     // injected by Dependency Manager
-    private volatile DependencyManager m_dm;
     private volatile LogService m_log;
-    private volatile AuthenticationService m_authService;
     private volatile ConnectionFactory m_connectionFactory;
     // See updated()
-    private boolean m_useAuth = false;
     private URL m_obrURL;
 
     private final String m_repositoryXML = "index.xml";
@@ -103,14 +95,6 @@ public class AgentDeploymentServlet exte
     @Override
     public void updated(Dictionary<String, ?> settings) throws ConfigurationException {
         if (settings != null) {
-            String useAuthString = (String) settings.get(KEY_USE_AUTHENTICATION);
-            if (useAuthString == null
-                || !("true".equalsIgnoreCase(useAuthString) || "false".equalsIgnoreCase(useAuthString))) {
-                throw new ConfigurationException(KEY_USE_AUTHENTICATION, "Missing or invalid value!");
-            }
-            boolean useAuth = Boolean.parseBoolean(useAuthString);
-            m_useAuth = useAuth;
-
             String obrURL = (String) settings.get(KEY_OBR_URL);
             try {
                 URL url = new URL(obrURL);
@@ -125,22 +109,10 @@ public class AgentDeploymentServlet exte
             }
         }
         else {
-            m_useAuth = false;
             m_obrURL = null;
         }
     }
 
-    /**
-     * Called by Dependency Manager upon initialization of this component.
-     * 
-     * @param comp the component to initialize, cannot be <code>null</code>.
-     */
-    protected void init(Component comp) {
-        comp.add(m_dm.createServiceDependency()
-            .setService(AuthenticationService.class).setRequired(m_useAuth)
-        );
-    }
-
     @Override
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         try {
@@ -165,37 +137,7 @@ public class AgentDeploymentServlet exte
 
     protected URLConnection openConnection(URL url) throws IOException {
         return m_connectionFactory.createConnection(url);
-    }
-
-    @Override
-    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        if (!authenticate(req)) {
-            // Authentication failed; don't proceed with the original request...
-            resp.sendError(SC_UNAUTHORIZED);
-        }
-        else {
-            // Authentication successful, proceed with original request...
-            super.service(req, resp);
-        }
-    }
-
-    /**
-     * Authenticates, if needed the user with the information from the given request.
-     * 
-     * @param request
-     *            the request to obtain the credentials from, cannot be <code>null</code>.
-     * @return <code>true</code> if the authentication was successful, <code>false</code> otherwise.
-     */
-    private boolean authenticate(HttpServletRequest request) {
-        if (m_useAuth) {
-            User user = m_authService.authenticate(request);
-            if (user == null) {
-                m_log.log(LogService.LOG_INFO, "Authentication failure!");
-            }
-            return (user != null);
-        }
-        return true;
-    }
+    }    
 
     private void closeSilently(Closeable resource) {
         try {

Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java (original)
+++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java Tue Feb 23 14:39:54 2016
@@ -18,12 +18,9 @@
  */
 package org.apache.ace.deployment.servlet;
 
-import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.Dictionary;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -34,29 +31,21 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.ace.authentication.api.AuthenticationService;
 import org.apache.ace.deployment.processor.DeploymentProcessor;
 import org.apache.ace.deployment.provider.ArtifactData;
 import org.apache.ace.deployment.provider.DeploymentProvider;
 import org.apache.ace.deployment.provider.OverloadedException;
 import org.apache.ace.deployment.streamgenerator.StreamGenerator;
-import org.apache.felix.dm.Component;
-import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
 import org.osgi.service.log.LogService;
-import org.osgi.service.useradmin.User;
 
 /**
  * The DeploymentServlet class provides in a list of versions available for a target and a stream of data containing the
  * DeploymentPackage (or fix package) for a specific target and version.
  */
-public class DeploymentServlet extends HttpServlet implements ManagedService {
+public class DeploymentServlet extends HttpServlet {
     private static final long serialVersionUID = 1L;
 
-    /** A boolean denoting whether or not authentication is enabled. */
-    private static final String KEY_USE_AUTHENTICATION = "authentication.enabled";
     /** HTTP header name used for Deployment Package size estimate, in bytes. */
     private static final String HEADER_DPSIZE = "X-ACE-DPSize";
     /** Multiplication factor for the DP size to account for slight changes in file change due to resource processors. */
@@ -71,13 +60,9 @@ public class DeploymentServlet extends H
     private final ConcurrentMap<String, DeploymentProcessor> m_processors = new ConcurrentHashMap<>();
 
     // injected by Dependency Manager
-    private volatile DependencyManager m_dm;
     private volatile LogService m_log;
     private volatile StreamGenerator m_streamGenerator;
     private volatile DeploymentProvider m_provider;
-    private volatile AuthenticationService m_authService;
-
-    private volatile boolean m_useAuth = false;
 
     public void addProcessor(ServiceReference<DeploymentProcessor> ref, DeploymentProcessor processor) {
         String key = (String) ref.getProperty(PROCESSOR);
@@ -102,23 +87,6 @@ public class DeploymentServlet extends H
         }
     }
 
-    @Override
-    public void updated(Dictionary<String, ?> settings) throws ConfigurationException {
-        if (settings != null) {
-            String useAuthString = (String) settings.get(KEY_USE_AUTHENTICATION);
-            if (useAuthString == null
-                || !("true".equalsIgnoreCase(useAuthString) || "false".equalsIgnoreCase(useAuthString))) {
-                throw new ConfigurationException(KEY_USE_AUTHENTICATION, "Missing or invalid value!");
-            }
-            boolean useAuth = Boolean.parseBoolean(useAuthString);
-
-            m_useAuth = useAuth;
-        }
-        else {
-            m_useAuth = false;
-        }
-    }
-
     /**
      * Responds to GET requests sent to this endpoint, the response depends on the requested path: <li>
      * http://host/endpoint/targetid/versions/ returns a list of versions available for the specified target <li>
@@ -189,49 +157,6 @@ public class DeploymentServlet extends H
         }
     }
 
-    /**
-     * Called by Dependency Manager upon initialization of this component.
-     * 
-     * @param comp
-     *            the component to initialize, cannot be <code>null</code>.
-     */
-    protected void init(Component comp) {
-        comp.add(m_dm.createServiceDependency()
-            .setService(AuthenticationService.class)
-            .setRequired(m_useAuth)
-            );
-    }
-
-    @Override
-    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        if (!authenticate(req)) {
-            // Authentication failed; don't proceed with the original request...
-            resp.sendError(SC_UNAUTHORIZED);
-        }
-        else {
-            // Authentication successful, proceed with original request...
-            super.service(req, resp);
-        }
-    }
-
-    /**
-     * Authenticates, if needed the user with the information from the given request.
-     * 
-     * @param request
-     *            the request to obtain the credentials from, cannot be <code>null</code>.
-     * @return <code>true</code> if the authentication was successful, <code>false</code> otherwise.
-     */
-    private boolean authenticate(HttpServletRequest request) {
-        if (m_useAuth) {
-            User user = m_authService.authenticate(request);
-            if (user == null) {
-                m_log.log(LogService.LOG_INFO, "Authentication failure!");
-            }
-            return (user != null);
-        }
-        return true;
-    }
-
     private long estimateDeploymentPackageSize(HttpServletRequest request, String targetID, String version) throws IOException, OverloadedException, AceRestException {
         List<String> versions = getVersions(targetID);
         String current = request.getParameter(CURRENT);

Modified: ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.gogo.servlet/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -1,14 +1,17 @@
 # Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
 
-Bundle-Version: 1.0.0
+Bundle-Version: 1.0.1
 -buildpath: \
 	${^-buildpath},\
 	osgi.core;version=6.0.0,\
 	osgi.cmpn,\
+	org.apache.felix.http.api,\
 	org.apache.felix.http.servlet-api,\
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.gogo;version=latest,\
 	org.apache.felix.gogo.runtime,\
-	org.apache.ace.authentication.api;version=latest
+	org.apache.ace.authentication.api;version=latest,\
+	org.apache.ace.http.api;version=latest
+	
 Bundle-Activator: org.apache.ace.gogo.servlet.Activator
 Private-Package: org.apache.ace.gogo.servlet

Modified: ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java (original)
+++ ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java Tue Feb 23 14:39:54 2016
@@ -18,9 +18,14 @@
  */
 package org.apache.ace.gogo.servlet;
 
+import static org.apache.ace.http.HttpConstants.ACE_WHITEBOARD_CONTEXT_SELECT_FILTER;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
+
+import java.util.Properties;
+
 import javax.servlet.Servlet;
 
-import org.apache.ace.authentication.api.AuthenticationService;
 import org.apache.felix.dm.DependencyActivatorBase;
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.service.command.CommandProcessor;
@@ -29,17 +34,17 @@ import org.osgi.service.log.LogService;
 
 public class Activator extends DependencyActivatorBase {
 
-    private static final String SCRIPT_SERVLET_PID = "org.apache.ace.gogo.servlet";
-
     @Override
     public void init(BundleContext context, DependencyManager manager) throws Exception {
+        Properties servletProps = new Properties();
+        servletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, "/gogo/*");
+        servletProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WHITEBOARD_CONTEXT_SELECT_FILTER);
+        
         manager.add(createComponent()
-            .setInterface(Servlet.class.getName(), null)
+            .setInterface(Servlet.class.getName(), servletProps)
             .setImplementation(ScriptServlet.class)
-            .add(createConfigurationDependency().setPropagate(true).setPid(SCRIPT_SERVLET_PID))
             .add(createServiceDependency().setService(CommandProcessor.class).setRequired(true))
             .add(createServiceDependency().setService(LogService.class).setRequired(false))
-            .add(createServiceDependency().setService(AuthenticationService.class).setRequired(true))
         );
     }
 

Modified: ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java (original)
+++ ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java Tue Feb 23 14:39:54 2016
@@ -18,8 +18,6 @@
  */
 package org.apache.ace.gogo.servlet;
 
-import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Dictionary;
@@ -32,13 +30,9 @@ import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.ace.authentication.api.AuthenticationService;
 import org.apache.felix.service.command.CommandProcessor;
 import org.apache.felix.service.command.CommandSession;
-import org.osgi.service.cm.ConfigurationException;
-import org.osgi.service.cm.ManagedService;
 import org.osgi.service.log.LogService;
-import org.osgi.service.useradmin.User;
 
 /**
  * Servlet that can execute a Gogo script provided by the caller. Note that this is a generic service that is not
@@ -50,17 +44,12 @@ import org.osgi.service.useradmin.User;
  * 
  * Motivation: provide the ability to script client calls to an ACE server for various automation purposes.
  */
-public class ScriptServlet extends HttpServlet implements ManagedService {
+public class ScriptServlet extends HttpServlet {
     private static final long serialVersionUID = -7838800050936438994L;
     private static final String SCRIPT_KEY = "script";
-    /** A boolean denoting whether or not authentication is enabled. */
-    private static final String KEY_USE_AUTHENTICATION = "authentication.enabled";
     
     private volatile LogService m_logger;
     private volatile CommandProcessor m_processor;
-    private volatile AuthenticationService m_authService;
-    
-    private boolean m_useAuth = false;
 
     @Override
     protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
@@ -76,33 +65,6 @@ public class ScriptServlet extends HttpS
         scriptDefinition.put(SCRIPT_KEY, script);
         respondToScriptRequest(resp, scriptDefinition);
     }
-    
-    @Override
-    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
-        if (!authenticate(req)) {
-            // Authentication failed; don't proceed with the original request...
-            resp.sendError(SC_UNAUTHORIZED);
-        } else {
-            // Authentication successful, proceed with original request...
-            super.service(req, resp);
-        }
-    }
-    /**
-     * Authenticates, if needed the user with the information from the given request.
-     * 
-     * @param request the request to obtain the credentials from, cannot be <code>null</code>.
-     * @return <code>true</code> if the authentication was successful, <code>false</code> otherwise.
-     */
-    private boolean authenticate(HttpServletRequest request) {
-        if (m_useAuth) {
-            User user = m_authService.authenticate(request);
-            if (user == null) {
-                m_logger.log(LogService.LOG_INFO, "Authentication failure!");
-            }
-            return (user != null);
-        }
-        return true;
-    }
 
     private void respondToScriptRequest(HttpServletResponse resp, Dictionary<String, String> scriptDefinition) throws IOException {
         try {
@@ -157,16 +119,4 @@ public class ScriptServlet extends HttpS
         }
     }
     
-    @Override
-    public void updated(Dictionary<String, ?> settings) throws ConfigurationException {
-        if (settings != null) {
-            String useAuthString = (String) settings.get(KEY_USE_AUTHENTICATION);
-            if (useAuthString == null
-                || !("true".equalsIgnoreCase(useAuthString) || "false".equalsIgnoreCase(useAuthString))) {
-                throw new ConfigurationException(KEY_USE_AUTHENTICATION, "Missing or invalid value!");
-            }
-            boolean useAuth = Boolean.parseBoolean(useAuthString);
-            m_useAuth = useAuth;
-        }
-    }
 }

Added: ace/trunk/org.apache.ace.http/api.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/api.bnd?rev=1731866&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/api.bnd (added)
+++ ace/trunk/org.apache.ace.http/api.bnd Tue Feb 23 14:39:54 2016
@@ -0,0 +1,4 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
+Bundle-Version: 1.0.0
+Export-Package: org.apache.ace.http
\ No newline at end of file

Modified: ace/trunk/org.apache.ace.http/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.http/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.http/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -6,5 +6,6 @@
 	osgi.cmpn,\
 	org.apache.felix.dependencymanager,\
 	org.apache.felix.http.api,\
-	org.apache.felix.http.servlet-api
+	org.apache.felix.http.servlet-api,\
+	org.apache.ace.authentication.api;version=latest
 -sub: *.bnd

Added: ace/trunk/org.apache.ace.http/context.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/context.bnd?rev=1731866&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/context.bnd (added)
+++ ace/trunk/org.apache.ace.http/context.bnd Tue Feb 23 14:39:54 2016
@@ -0,0 +1,5 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
+Private-Package: org.apache.ace.http.context
+Bundle-Version: 1.0.0
+Bundle-Activator: org.apache.ace.http.context.Activator
\ No newline at end of file

Added: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java?rev=1731866&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java (added)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java Tue Feb 23 14:39:54 2016
@@ -0,0 +1,34 @@
+/*
+ * 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.ace.http;
+
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME;
+
+public interface HttpConstants {
+    /**
+     * Name used for binding the servlets from ACE to the servlet context helper from ACE.
+     */
+    String ACE_WHITEBOARD_CONTEXT_NAME = "org.apache.ace";
+
+    /**
+     * Filter used to bind the servlets to the servlet context helper from ACE.
+     */
+    String ACE_WHITEBOARD_CONTEXT_SELECT_FILTER = "(" + HTTP_WHITEBOARD_CONTEXT_NAME + "=" + ACE_WHITEBOARD_CONTEXT_NAME + ")";
+
+}

Added: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java?rev=1731866&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java (added)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java Tue Feb 23 14:39:54 2016
@@ -0,0 +1,125 @@
+/*
+ * 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.ace.http.context;
+
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH;
+
+import java.io.IOException;
+import java.util.Dictionary;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.ace.authentication.api.AuthenticationService;
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.osgi.service.http.context.ServletContextHelper;
+import org.osgi.service.useradmin.User;
+
+public class AceServletContextHelper extends ServletContextHelper implements ManagedService {
+
+    private static final String KEY_USE_AUTHENTICATION = "authentication.enabled";
+    private static final String KEY_CONTEXT_PATH = "context.path";
+
+    private static final String DEFAULT_CONTEXT_PATH = "/";
+
+    private volatile DependencyManager m_dependencyManager;
+    private volatile Component m_component;
+    private volatile AuthenticationService m_authenticationService;
+
+    private volatile boolean m_useAuth;
+
+    public AceServletContextHelper() {
+        super();
+    }
+
+    @Override
+    public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        return authenticate(request);
+    }
+
+    /**
+     * Called by Dependency Manager upon initialization of this component.
+     * 
+     * @param comp
+     *            the component to initialize, cannot be <code>null</code>.
+     */
+    protected void init() {
+        m_component.add(m_dependencyManager.createServiceDependency()
+            .setService(AuthenticationService.class)
+            .setRequired(m_useAuth));
+    }
+
+    public void updated(Dictionary<String, ?> settings) throws ConfigurationException {
+        boolean useAuth = false;
+        String contextPath = DEFAULT_CONTEXT_PATH;
+
+        if (settings != null) {
+            Object value = settings.get(KEY_USE_AUTHENTICATION);
+            if (value == null || "".equals(value)) {
+                throw new ConfigurationException(KEY_USE_AUTHENTICATION, "Missing or invalid value!");
+            }
+            useAuth = Boolean.parseBoolean(value.toString());
+
+            value = settings.get(KEY_CONTEXT_PATH);
+            if (value != null) {
+                if ("".equals(value)) {
+                    throw new ConfigurationException(KEY_CONTEXT_PATH, "Invalid value!");
+                }
+                contextPath = value.toString();
+            }
+
+            if (!"/".equals(contextPath) && (!contextPath.startsWith("/") || contextPath.endsWith("/"))) {
+                throw new ConfigurationException(KEY_CONTEXT_PATH, "Invalid value context path, context path should start with a '/' and NOT end with a '/'!");
+            }
+        }
+
+        m_useAuth = useAuth;
+        updateContextPath(contextPath);
+    }
+
+    private void updateContextPath(String pattern) {
+        Dictionary<Object, Object> serviceProperties = m_component.getServiceProperties();
+        if (!pattern.equals(serviceProperties.get(HTTP_WHITEBOARD_CONTEXT_PATH))) {
+            serviceProperties.put(HTTP_WHITEBOARD_CONTEXT_PATH, pattern);
+            m_component.setServiceProperties(serviceProperties);
+        }
+    }
+
+    /**
+     * Authenticates, if needed the user with the information from the given request.
+     * 
+     * @param request
+     *            The request to obtain the credentials from, cannot be <code>null</code>.
+     * @return <code>true</code> if the authentication was successful, <code>false</code> otherwise.
+     */
+    private boolean authenticate(HttpServletRequest request) {
+        if (m_useAuth) {
+            User user = m_authenticationService.authenticate(request);
+
+            request.setAttribute("org.apache.ace.authentication.user", user);
+
+            return user != null;
+        }
+        return true;
+    }
+
+}

Added: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java?rev=1731866&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java (added)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java Tue Feb 23 14:39:54 2016
@@ -0,0 +1,47 @@
+/*
+ * 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.ace.http.context;
+
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME;
+
+import java.util.Properties;
+
+import org.apache.ace.http.HttpConstants;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.http.context.ServletContextHelper;
+import org.osgi.service.log.LogService;
+
+public class Activator extends DependencyActivatorBase {
+    private static final String PID = "org.apache.ace.http.context";
+
+    @Override
+    public void init(BundleContext context, DependencyManager manager) throws Exception {
+        Properties props = new Properties();
+        props.put(HTTP_WHITEBOARD_CONTEXT_NAME, HttpConstants.ACE_WHITEBOARD_CONTEXT_NAME);
+
+        manager.add(createComponent()
+            .setInterface(ServletContextHelper.class.getName(), props)
+            .setImplementation(AceServletContextHelper.class)
+            .add(createConfigurationDependency().setPid(PID))
+            .add(createServiceDependency().setService(LogService.class).setRequired(false)));
+    }
+
+}

Added: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/package-info.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/package-info.java?rev=1731866&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/package-info.java (added)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/package-info.java Tue Feb 23 14:39:54 2016
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+@aQute.bnd.annotation.Version("1.0.0")
+package org.apache.ace.http;

Modified: ace/trunk/org.apache.ace.log.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.itest/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log.itest/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -48,7 +48,9 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.feedback.common;version=latest,\
 	org.apache.ace.log.api;version=latest,\
-	org.apache.ace.feedback.common;version=latest
+	org.apache.ace.feedback.common;version=latest,\
+	org.apache.ace.http.context;version=latest
+	
 Private-Package: org.apache.ace.it.log
 Bundle-Version: 1.0.0
 Bundle-Name: Apache ACE Log itest

Modified: ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java (original)
+++ ace/trunk/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java Tue Feb 23 14:39:54 2016
@@ -18,8 +18,6 @@
  */
 package org.apache.ace.it.log;
 
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
@@ -43,9 +41,7 @@ import org.osgi.service.http.HttpService
  * replicated to the server.
  */
 public class LogIntegrationTest extends IntegrationTestBase {
-
 	private static final String AUDITLOG = "/auditlog";
-    private static final String DEPLOYMENT = "/deployment";
 
     public static final String HOST = "localhost";
     public static final String TARGET_ID = "target-id";
@@ -73,22 +69,17 @@ public class LogIntegrationTest extends
         configureFactory("org.apache.ace.target.log.factory",
                 "name", "auditlog");
         configureFactory("org.apache.ace.target.log.sync.factory",
-                "name", "auditlog", 
-                "authentication.enabled", "false");
-
-        configure("org.apache.ace.deployment.servlet",
-                HTTP_WHITEBOARD_SERVLET_PATTERN, DEPLOYMENT.concat("/*"), 
-                "authentication.enabled", "false");
+                "name", "auditlog");
 
         configure("org.apache.ace.log.server.store.filebased", 
                 "MaxEvents", "0");
         
         configureFactory("org.apache.ace.log.server.servlet.factory",
-                "name", "auditlog",
-                HTTP_WHITEBOARD_SERVLET_PATTERN, AUDITLOG.concat("/*"), 
-                "authentication.enabled", "false");
+                "name", "auditlog", "endpoint", AUDITLOG);
         configureFactory("org.apache.ace.log.server.store.factory",
                 "name", "auditlog");
+
+        configure("org.apache.ace.http.context", "authentication.enabled", "false");
     }
 
     protected Component[] getDependencies() {

Modified: ace/trunk/org.apache.ace.log/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/bnd.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log/bnd.bnd Tue Feb 23 14:39:54 2016
@@ -5,6 +5,7 @@
 	${testng},\
 	osgi.core;version=6.0.0,\
 	osgi.cmpn,\
+	org.apache.felix.http.api,\
 	org.apache.felix.http.servlet-api,\
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.range.api;version=latest,\
@@ -14,6 +15,7 @@
 	org.apache.ace.scheduler.api;version=latest,\
 	org.apache.ace.connectionfactory;version=latest,\
 	org.apache.ace.authentication.api;version=latest,\
-	org.apache.ace.feedback.common;version=latest
+	org.apache.ace.feedback.common;version=latest,\
+	org.apache.ace.http.api;version=latest
 
 -sub: *.bnd

Modified: ace/trunk/org.apache.ace.log/server.servlet.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log/server.servlet.bnd?rev=1731866&r1=1731865&r2=1731866&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log/server.servlet.bnd (original)
+++ ace/trunk/org.apache.ace.log/server.servlet.bnd Tue Feb 23 14:39:54 2016
@@ -2,6 +2,6 @@
 
 Private-Package: org.apache.ace.log.server.servlet
 Bundle-Activator: org.apache.ace.log.server.servlet.Activator
-Bundle-Version: 1.0.2
+Bundle-Version: 1.0.3
 Bundle-Name: Apache ACE Log Server Servlet
 Bundle-Description: Registers a service factory for Log Server servlets




Mime
View raw message