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.
git-svn-id: https://svn.apache.org/repos/asf/ace/trunk@1731866 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.apache.ace.authentication.itest/bnd.bnd b/org.apache.ace.authentication.itest/bnd.bnd
index e98ce7e..6c9347b 100644
--- a/org.apache.ace.authentication.itest/bnd.bnd
+++ b/org.apache.ace.authentication.itest/bnd.bnd
@@ -65,7 +65,8 @@
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
diff --git a/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java b/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
index d010908..d42cafc 100644
--- a/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
+++ b/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/LogAuthenticationTest.java
@@ -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 @@
* 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 @@
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 @@
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
diff --git a/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java b/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java
index 6f58daa..b2ee8c4 100644
--- a/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java
+++ b/org.apache.ace.authentication.itest/src/org/apache/ace/it/authentication/ObrAuthenticationTest.java
@@ -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 @@
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 @@
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 @@
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...
diff --git a/org.apache.ace.bnd/registry.bnd b/org.apache.ace.bnd/registry.bnd
index 9e57c2b..d0be0c9 100644
--- a/org.apache.ace.bnd/registry.bnd
+++ b/org.apache.ace.bnd/registry.bnd
@@ -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
diff --git a/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory b/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory
index dd148dc..3c34dde 100644
--- a/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory
+++ b/org.apache.ace.bnd/services/org.apache.ace.connectionfactory.ConnectionFactory
@@ -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
diff --git a/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java b/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java
index 50508f8..0f97734 100644
--- a/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java
+++ b/org.apache.ace.bnd/src/org/apache/ace/bnd/registry/RegistryImpl.java
@@ -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;
diff --git a/org.apache.ace.client.repository.itest/bnd.bnd b/org.apache.ace.client.repository.itest/bnd.bnd
index 6444867..340aabf 100644
--- a/org.apache.ace.client.repository.itest/bnd.bnd
+++ b/org.apache.ace.client.repository.itest/bnd.bnd
@@ -67,7 +67,9 @@
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,\
diff --git a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
index 26e8b6b..349f5ff 100644
--- a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
+++ b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/BaseRepositoryAdminTest.java
@@ -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 @@
}
}
- 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 @@
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 @@
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 @@
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 @@
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 @@
}
});
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 @@
}
}
- 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 @@
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++) {
diff --git a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java
index f9511a4..accb6d6 100644
--- a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java
+++ b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/ClientAutomationTest.java
@@ -44,8 +44,6 @@
* to do with this operator.
*/
public void testAutoTargetOperator() throws Exception {
- startRepositoryService();
-
createTestUser();
addRepository("storeInstance", "apache", "store", true);
diff --git a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java
index e701d2a..4485f0c 100644
--- a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java
+++ b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/RepositoryAdminTest.java
@@ -139,8 +139,6 @@
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 @@
}
}, 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 @@
assertTrue(m_artifactRepository.get().size() == 1);
assertTrue(m_artifactRepository.getResourceProcessors().size() == 1);
-
- deleteObr("/obr");
}
public void testImportArtifactInvalidURL() throws Exception {
@@ -324,8 +319,6 @@
InvalidSyntaxException {
User user1 = new MockUser();
- startRepositoryService();
-
addRepository("storeInstance", "apache", "store", true);
addRepository("targetInstance", "apache", "target", true);
@@ -355,8 +348,6 @@
public void testReadOnlyRepositoryAccess() throws Exception {
User user1 = new MockUser();
- startRepositoryService();
-
addRepository("storeInstance", "apache", "store", true);
addRepository("targetInstance", "apache", "target", true);
@@ -453,8 +444,6 @@
final User user1 = new MockUser();
final User user2 = new MockUser();
- startRepositoryService();
-
addRepository("storeInstance", "apache", "store", true);
addRepository("targetInstance", "apache", "target", true);
diff --git a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java
index 638d915..ea15136 100644
--- a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java
+++ b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/StatefulTargetRepositoryTest.java
@@ -763,8 +763,6 @@
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);
diff --git a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
index 816e978..a2d85b2 100644
--- a/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
+++ b/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
@@ -303,8 +303,6 @@
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 @@
inFile = tryGetStringFromURL(findXmlUrlInDeploymentObject(dvo), 10, 100);
assertEquals(xmlHeader + simpleTemplateProcessed + xmlFooter, inFile);
-
- deleteObr("/obr");
}
/**
diff --git a/org.apache.ace.client.rest.itest/bnd.bnd b/org.apache.ace.client.rest.itest/bnd.bnd
index 93e5694..e0022ae 100644
--- a/org.apache.ace.client.rest.itest/bnd.bnd
+++ b/org.apache.ace.client.rest.itest/bnd.bnd
@@ -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,\
diff --git a/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java b/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
index d60dcbe..203f9a2 100644
--- a/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
+++ b/org.apache.ace.client.rest.itest/src/org/apache/ace/client/rest/itest/RESTClientTest.java
@@ -33,7 +33,6 @@
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 @@
"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 @@
"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 @@
"customer", "apache",
"master", "true");
+ configure("org.apache.ace.http.context", "authentication.enabled", "false");
}
/** Create a user so we can log in to the server. */
diff --git a/org.apache.ace.client.rest/bnd.bnd b/org.apache.ace.client.rest/bnd.bnd
index d5c9455..0cde876 100644
--- a/org.apache.ace.client.rest/bnd.bnd
+++ b/org.apache.ace.client.rest/bnd.bnd
@@ -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,\
diff --git a/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java b/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java
index 7f04ec3..0bad473 100644
--- a/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java
+++ b/org.apache.ace.client.rest/src/org/apache/ace/client/rest/Activator.java
@@ -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 @@
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)));
}
}
diff --git a/org.apache.ace.deployment.itest/bnd.bnd b/org.apache.ace.deployment.itest/bnd.bnd
index d355911..a19e84c 100644
--- a/org.apache.ace.deployment.itest/bnd.bnd
+++ b/org.apache.ace.deployment.itest/bnd.bnd
@@ -61,7 +61,9 @@
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,\
diff --git a/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java b/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
index 90604bd..168c2b7 100644
--- a/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
+++ b/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/Ace330Test.java
@@ -22,7 +22,6 @@
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 @@
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 @@
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
diff --git a/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java b/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java
index fe641e3..04a1510 100644
--- a/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java
+++ b/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java
@@ -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 @@
}
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 {
diff --git a/org.apache.ace.deployment/bnd.bnd b/org.apache.ace.deployment/bnd.bnd
index 1aa32b6..c6872bb 100644
--- a/org.apache.ace.deployment/bnd.bnd
+++ b/org.apache.ace.deployment/bnd.bnd
@@ -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
diff --git a/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java b/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java
index 2f1c642..1817854 100644
--- a/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java
+++ b/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/Activator.java
@@ -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.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
diff --git a/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java b/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
index 767b548..f2a55b9 100644
--- a/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
+++ b/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
@@ -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.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 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 @@
@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 @@
}
}
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 @@
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 {
diff --git a/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java b/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
index 1732985..2509433 100644
--- a/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
+++ b/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java
@@ -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.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 @@
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 @@
}
}
- @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 @@
}
}
- /**
- * 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);
diff --git a/org.apache.ace.gogo.servlet/bnd.bnd b/org.apache.ace.gogo.servlet/bnd.bnd
index 4136e08..87f29dc 100644
--- a/org.apache.ace.gogo.servlet/bnd.bnd
+++ b/org.apache.ace.gogo.servlet/bnd.bnd
@@ -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
diff --git a/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java b/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java
index 8bc3591..3851795 100644
--- a/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java
+++ b/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/Activator.java
@@ -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 @@
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))
);
}
diff --git a/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java b/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java
index 34152f7..e88218d 100644
--- a/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java
+++ b/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java
@@ -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.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 @@
*
* 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 @@
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 @@
}
}
- @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;
- }
- }
}
diff --git a/org.apache.ace.http.itest/.project b/org.apache.ace.http.itest/.project
deleted file mode 100644
index da7b99c..0000000
--- a/org.apache.ace.http.itest/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.apache.ace.http.itest</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>bndtools.core.bndbuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>bndtools.core.bndnature</nature>
- </natures>
-</projectDescription>
diff --git a/org.apache.ace.http.itest/test/.gitignore b/org.apache.ace.http.itest/test/.gitignore
deleted file mode 100644
index e69de29..0000000
--- a/org.apache.ace.http.itest/test/.gitignore
+++ /dev/null
diff --git a/run-obr/conf/org.apache.ace.obr.servlet.cfg b/org.apache.ace.http/api.bnd
similarity index 61%
rename from run-obr/conf/org.apache.ace.obr.servlet.cfg
rename to org.apache.ace.http/api.bnd
index 19bc459..d169f42 100644
--- a/run-obr/conf/org.apache.ace.obr.servlet.cfg
+++ b/org.apache.ace.http/api.bnd
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/obr/*
-authentication.enabled = false
+Bundle-Version: 1.0.0
+Export-Package: org.apache.ace.http
\ No newline at end of file
diff --git a/org.apache.ace.http/bnd.bnd b/org.apache.ace.http/bnd.bnd
index c124295..2bb9a80 100644
--- a/org.apache.ace.http/bnd.bnd
+++ b/org.apache.ace.http/bnd.bnd
@@ -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
diff --git a/org.apache.ace.http/context.bnd b/org.apache.ace.http/context.bnd
new file mode 100644
index 0000000..c992df3
--- /dev/null
+++ b/org.apache.ace.http/context.bnd
@@ -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
diff --git a/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java b/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java
new file mode 100644
index 0000000..1fa92f2
--- /dev/null
+++ b/org.apache.ace.http/src/org/apache/ace/http/HttpConstants.java
@@ -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 + ")";
+
+}
diff --git a/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java b/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java
new file mode 100644
index 0000000..bcdc11d
--- /dev/null
+++ b/org.apache.ace.http/src/org/apache/ace/http/context/AceServletContextHelper.java
@@ -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;
+ }
+
+}
diff --git a/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java b/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java
new file mode 100644
index 0000000..412def3
--- /dev/null
+++ b/org.apache.ace.http/src/org/apache/ace/http/context/Activator.java
@@ -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)));
+ }
+
+}
diff --git a/org.apache.ace.http/src/org/apache/ace/http/package-info.java b/org.apache.ace.http/src/org/apache/ace/http/package-info.java
new file mode 100644
index 0000000..21fbe2b
--- /dev/null
+++ b/org.apache.ace.http/src/org/apache/ace/http/package-info.java
@@ -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;
diff --git a/org.apache.ace.log.itest/bnd.bnd b/org.apache.ace.log.itest/bnd.bnd
index d247d96..e94e2ed 100644
--- a/org.apache.ace.log.itest/bnd.bnd
+++ b/org.apache.ace.log.itest/bnd.bnd
@@ -48,7 +48,9 @@
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
diff --git a/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java b/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java
index 96e5824..f6db050 100644
--- a/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java
+++ b/org.apache.ace.log.itest/src/org/apache/ace/it/log/LogIntegrationTest.java
@@ -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 @@
* 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 @@
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() {
diff --git a/org.apache.ace.log/bnd.bnd b/org.apache.ace.log/bnd.bnd
index 2926deb..30abf9d 100644
--- a/org.apache.ace.log/bnd.bnd
+++ b/org.apache.ace.log/bnd.bnd
@@ -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
diff --git a/org.apache.ace.log/server.servlet.bnd b/org.apache.ace.log/server.servlet.bnd
index a467067..6573f21 100644
--- a/org.apache.ace.log/server.servlet.bnd
+++ b/org.apache.ace.log/server.servlet.bnd
@@ -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
diff --git a/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java b/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java
index 9c71cbd..f098ae9 100644
--- a/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java
+++ b/org.apache.ace.log/src/org/apache/ace/log/server/servlet/Activator.java
@@ -18,14 +18,17 @@
*/
package org.apache.ace.log.server.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.Dictionary;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import javax.servlet.Servlet;
-import org.apache.ace.authentication.api.AuthenticationService;
import org.apache.ace.log.server.store.LogStore;
import org.apache.felix.dm.Component;
import org.apache.felix.dm.DependencyActivatorBase;
@@ -37,30 +40,16 @@
import org.osgi.service.log.LogService;
public class Activator extends DependencyActivatorBase implements ManagedServiceFactory {
+ private static final String PID = "org.apache.ace.log.server.servlet.factory";
private static final String KEY_LOG_NAME = "name";
+ private static final String KEY_ENDPOINT = "endpoint";
- /** A boolean denoting whether or not authentication is enabled. */
- private static final String KEY_USE_AUTHENTICATION = "authentication.enabled";
-
- private final Map<String, Component> m_instances = new HashMap<>(); // String -> Service
- private DependencyManager m_manager;
+ private final ConcurrentMap<String, Component> m_instances = new ConcurrentHashMap<>();
+ // Managed by Felix DM...
+ private volatile DependencyManager m_manager;
private volatile LogService m_log;
- @Override
- public void init(BundleContext context, DependencyManager manager) throws Exception {
- m_manager = manager;
- Properties props = new Properties();
- props.put(Constants.SERVICE_PID, "org.apache.ace.log.server.servlet.factory");
- manager.add(createComponent()
- .setInterface(ManagedServiceFactory.class.getName(), props)
- .setImplementation(this)
- .add(createServiceDependency().setService(LogService.class).setRequired(false))); }
-
- @Override
- public void destroy(BundleContext context, DependencyManager manager) throws Exception {
- }
-
public void deleted(String pid) {
Component log = m_instances.remove(pid);
if (log != null) {
@@ -72,32 +61,58 @@
return "Log Servlet Factory";
}
+ @Override
+ public void init(BundleContext context, DependencyManager manager) throws Exception {
+ Properties props = new Properties();
+ props.put(Constants.SERVICE_PID, PID);
+
+ manager.add(createComponent()
+ .setInterface(ManagedServiceFactory.class.getName(), props)
+ .setImplementation(this)
+ .add(createServiceDependency().setService(LogService.class).setRequired(false)));
+ }
+
public void updated(String pid, Dictionary<String, ?> dict) throws ConfigurationException {
String name = (String) dict.get(KEY_LOG_NAME);
- if ((name == null) || "".equals(name)) {
- throw new ConfigurationException(KEY_LOG_NAME, "Log name has to be specified: " + name);
+ if (name == null || "".equals(name.trim())) {
+ throw new ConfigurationException(KEY_LOG_NAME, "Log name has to be specified!");
}
-
- String useAuthString = (String) dict.get(KEY_USE_AUTHENTICATION);
- if (useAuthString == null
- || !("true".equalsIgnoreCase(useAuthString) || "false".equalsIgnoreCase(useAuthString))) {
- throw new ConfigurationException(KEY_USE_AUTHENTICATION, "Missing or invalid value: " + useAuthString);
+
+ String endpoint = (String) dict.get(KEY_ENDPOINT);
+ if (endpoint == null || "".equals(endpoint.trim())) {
+ throw new ConfigurationException(KEY_ENDPOINT, "Endpoint name must be specified!");
}
- boolean useAuth = Boolean.parseBoolean(useAuthString);
+
+ Properties servletProps = new Properties();
+ servletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, toPattern(endpoint));
+ servletProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WHITEBOARD_CONTEXT_SELECT_FILTER);
+ servletProps.put(KEY_LOG_NAME, name);
Component service = m_instances.get(pid);
if (service == null) {
service = m_manager.createComponent()
- .setInterface(Servlet.class.getName(), dict)
- .setImplementation(new LogServlet(name, useAuth))
- .add(createServiceDependency().setService(AuthenticationService.class).setRequired(useAuth))
+ .setInterface(Servlet.class.getName(), servletProps)
+ .setImplementation(new LogServlet(name))
.add(createServiceDependency().setService(LogService.class).setRequired(false))
- .add(createServiceDependency().setService(LogStore.class, "(&("+Constants.OBJECTCLASS+"="+LogStore.class.getName()+")(name=" + name + "))").setRequired(true));
+ .add(createServiceDependency().setService(LogStore.class, "(name=" + name + ")").setRequired(true));
- m_instances.put(pid, service);
- m_manager.add(service);
- } else {
- m_log.log(LogService.LOG_INFO, "Ignoring configuration update because factory instance was already configured: " + name);
+ if (m_instances.putIfAbsent(pid, service) == null) {
+ m_manager.add(service);
+ }
+ }
+ else {
+ m_log.log(LogService.LOG_WARNING, "Ignoring configuration update because factory instance was already configured: " + name);
}
}
-}
\ No newline at end of file
+
+ private Object toPattern(String endpoint) {
+ final String suffix = "/*";
+ if ("/".equals(endpoint)) {
+ return suffix;
+ }
+ if (!endpoint.endsWith(suffix)) {
+ return endpoint.concat(suffix);
+ }
+ return endpoint;
+ }
+}
diff --git a/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java b/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java
index 044e2b1..74ad089 100644
--- a/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java
+++ b/org.apache.ace.log/src/org/apache/ace/log/server/servlet/LogServlet.java
@@ -18,29 +18,24 @@
*/
package org.apache.ace.log.server.servlet;
-import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
-import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
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.feedback.Descriptor;
import org.apache.ace.feedback.Event;
import org.apache.ace.feedback.LowestID;
import org.apache.ace.log.server.store.LogStore;
import org.apache.ace.range.SortedRangeSet;
import org.osgi.service.log.LogService;
-import org.osgi.service.useradmin.User;
/**
* This class acts as a servlet and handles the log protocol. This means a number of requests will be handled:
@@ -88,14 +83,11 @@
// injected by Dependency Manager
private volatile LogService m_log;
private volatile LogStore m_store;
- private volatile AuthenticationService m_authService;
private final String m_name;
- private final boolean m_useAuth;
- public LogServlet(String name, boolean useAuth) {
+ public LogServlet(String name) {
m_name = name;
- m_useAuth = useAuth;
}
@Override
@@ -155,34 +147,6 @@
}
}
- @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;
- }
-
// Handle a call to the query 'command'
protected boolean handleQuery(String targetID, String logID, String filter, ServletOutputStream output) throws IOException {
if ((targetID != null) && (logID != null)) {
diff --git a/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java b/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
index ae9cc8f..9bc91f7 100644
--- a/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
+++ b/org.apache.ace.log/test/org/apache/ace/log/server/servlet/LogServletTest.java
@@ -53,7 +53,7 @@
@BeforeMethod(alwaysRun = true)
protected void setUp() throws Exception {
- m_logServlet = new LogServlet("test", false /* useAuth */);
+ m_logServlet = new LogServlet("test");
TestUtils.configureObject(m_logServlet, LogService.class);
m_mockStore = new MockLogStore();
TestUtils.configureObject(m_logServlet, LogStore.class, m_mockStore);
diff --git a/org.apache.ace.obr/bnd.bnd b/org.apache.ace.obr/bnd.bnd
index 5074335..f382cb4 100644
--- a/org.apache.ace.obr/bnd.bnd
+++ b/org.apache.ace.obr/bnd.bnd
@@ -14,6 +14,7 @@
org.apache.ace.deployment.provider.api;version=latest,\
org.apache.ace.deployment.provider.base;version=latest,\
org.apache.ace.deployment.util.test;version=latest,\
+ org.apache.ace.http.api;version=latest,\
org.osgi.impl.bundle.repoindex.lib;packages="org.osgi.service.indexer,org.osgi.service.indexer.impl"
diff --git a/org.apache.ace.obr/src/org/apache/ace/obr/servlet/Activator.java b/org.apache.ace.obr/src/org/apache/ace/obr/servlet/Activator.java
index 01720ff..89a87ce 100644
--- a/org.apache.ace.obr/src/org/apache/ace/obr/servlet/Activator.java
+++ b/org.apache.ace.obr/src/org/apache/ace/obr/servlet/Activator.java
@@ -18,6 +18,12 @@
*/
package org.apache.ace.obr.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.obr.storage.BundleStore;
@@ -27,16 +33,16 @@
import org.osgi.service.log.LogService;
public class Activator extends DependencyActivatorBase {
- public static final String PID = "org.apache.ace.obr.servlet";
@Override
public void init(BundleContext context, DependencyManager manager) throws Exception {
+ Properties servletProps = new Properties();
+ servletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, BundleServlet.SERVLET_ENDPOINT.concat("*"));
+ 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(BundleServlet.class)
- .add(createConfigurationDependency()
- .setPropagate(true)
- .setPid(PID))
.add(createServiceDependency()
.setService(BundleStore.class)
.setRequired(true))
@@ -44,9 +50,4 @@
.setService(LogService.class)
.setRequired(false)));
}
-
- @Override
- public void destroy(BundleContext context, DependencyManager manager) throws Exception {
- // do nothing
- }
-}
\ No newline at end of file
+}
diff --git a/org.apache.ace.obr/src/org/apache/ace/obr/servlet/BundleServlet.java b/org.apache.ace.obr/src/org/apache/ace/obr/servlet/BundleServlet.java
index 7c38d88..b2f83df 100644
--- a/org.apache.ace.obr/src/org/apache/ace/obr/servlet/BundleServlet.java
+++ b/org.apache.ace.obr/src/org/apache/ace/obr/servlet/BundleServlet.java
@@ -24,14 +24,11 @@
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
import static javax.servlet.http.HttpServletResponse.SC_OK;
-import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Dictionary;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
@@ -39,82 +36,28 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.ace.authentication.api.AuthenticationService;
import org.apache.ace.obr.storage.BundleStore;
-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.log.LogService;
-import org.osgi.service.useradmin.User;
/**
* Provides access to the OBR through a REST-ish API.
*/
-public class BundleServlet extends HttpServlet implements ManagedService {
+public class BundleServlet 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";
-
private static final int COPY_BUFFER_SIZE = 4096;
public static final String TEXT_MIMETYPE = "text/plain";
+ public static final String SERVLET_ENDPOINT = "/obr/";
- private volatile DependencyManager m_dm; // injected by Dependency Manager
private volatile LogService m_log; /* will be injected by dependencymanager */
private volatile BundleStore m_store; /* will be injected by dependencymanager */
- private volatile AuthenticationService m_authService;
-
- private volatile String m_servletEndpoint = "/";
- private volatile boolean m_useAuth = false;
@Override
public String getServletInfo() {
return "Apache ACE OBR Servlet";
}
- 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;
-
- m_servletEndpoint = (String) settings.get(HTTP_WHITEBOARD_SERVLET_PATTERN);
- if(m_servletEndpoint == null){
- m_servletEndpoint = "/";
- }
- if(!m_servletEndpoint.startsWith("/")){
- m_servletEndpoint = "/" + m_servletEndpoint;
- }
- if(m_servletEndpoint.endsWith("/*")){
- m_servletEndpoint = m_servletEndpoint.substring(0, m_servletEndpoint.length() -1);
- }
- if (!m_servletEndpoint.endsWith("/")) {
- m_servletEndpoint = m_servletEndpoint + "/";
- }
- }
- else {
- m_useAuth = false;
- }
- }
-
- /**
- * 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)
- );
- }
-
/**
* Responds to POST requests sent to http://host:port/obr by writing the received data to the bundle store and
* returning the persistent location. Will send out a response that contains one of the following status codes:
@@ -279,37 +222,6 @@
}
}
- /**
- * {@inheritDoc}
- */
- @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 closeSafely(Closeable resource, HttpServletRequest request) {
if (resource != null) {
try {
@@ -334,7 +246,7 @@
if(!ignorePort){
locationBuilder.append(":" + request.getServerPort());
}
- locationBuilder.append(m_servletEndpoint).append(relativePath);
+ locationBuilder.append(SERVLET_ENDPOINT).append(relativePath);
response.setHeader("Location", locationBuilder.toString());
response.setStatus(SC_CREATED);
}
diff --git a/org.apache.ace.repository.itest/bnd.bnd b/org.apache.ace.repository.itest/bnd.bnd
index e87a143..ba1c822 100644
--- a/org.apache.ace.repository.itest/bnd.bnd
+++ b/org.apache.ace.repository.itest/bnd.bnd
@@ -25,7 +25,9 @@
org.apache.ace.range.api;version=latest,\
org.apache.ace.repository.api;version=latest,\
org.apache.ace.repository.impl;version=latest,\
- org.apache.ace.repository.servlets;version=latest
+ org.apache.ace.repository.servlets;version=latest,\
+ org.apache.ace.http.context;version=latest
+
Private-Package: org.apache.ace.it.repository
Bundle-Version: 1.0.0
Bundle-Name: Apache ACE Repository itest
diff --git a/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java b/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java
index 3d20ae9..be57757 100644
--- a/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java
+++ b/org.apache.ace.repository.itest/src/org/apache/ace/it/repository/RepositoryTest.java
@@ -21,7 +21,6 @@
import static org.apache.ace.it.repository.Utils.get;
import static org.apache.ace.it.repository.Utils.put;
import static org.apache.ace.it.repository.Utils.query;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -298,12 +297,7 @@
protected void configureProvisionedServices() throws IOException {
m_host = new URL("http://localhost:" + TestConstants.PORT);
- 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");
Utils.waitForWebserver(m_host);
}
diff --git a/org.apache.ace.repository/bnd.bnd b/org.apache.ace.repository/bnd.bnd
index ed33f04..4504c91 100644
--- a/org.apache.ace.repository/bnd.bnd
+++ b/org.apache.ace.repository/bnd.bnd
@@ -6,11 +6,14 @@
osgi.core;version=6.0.0,\
osgi.cmpn,\
org.apache.felix.dependencymanager,\
+ org.apache.felix.http.api,\
org.apache.felix.http.servlet-api,\
org.apache.ace.range.api;version=latest,\
org.apache.ace.test;version=latest,\
org.apache.ace.authentication.api;version=latest,\
org.apache.ace.scheduler.api;version=latest,\
org.apache.ace.discovery.api;version=latest,\
- org.apache.ace.connectionfactory;version=latest
+ org.apache.ace.connectionfactory;version=latest,\
+ org.apache.ace.http.api;version=latest
+
-sub: *.bnd
diff --git a/org.apache.ace.repository/src/org/apache/ace/repository/servlet/Activator.java b/org.apache.ace.repository/src/org/apache/ace/repository/servlet/Activator.java
index 4650640..181a8fc 100644
--- a/org.apache.ace.repository/src/org/apache/ace/repository/servlet/Activator.java
+++ b/org.apache.ace.repository/src/org/apache/ace/repository/servlet/Activator.java
@@ -18,6 +18,12 @@
*/
package org.apache.ace.repository.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.felix.dm.DependencyActivatorBase;
@@ -26,27 +32,25 @@
import org.osgi.service.log.LogService;
public class Activator extends DependencyActivatorBase {
- public static final String REPOSITORY_PID = "org.apache.ace.repository.servlet.RepositoryServlet";
- public static final String REPOSITORY_REPLICATION_PID = "org.apache.ace.repository.servlet.RepositoryReplicationServlet";
-
+
@Override
public void init(BundleContext context, DependencyManager manager) throws Exception {
+ Properties repositoryServletProps = new Properties();
+ repositoryServletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, "/repository/*");
+ repositoryServletProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WHITEBOARD_CONTEXT_SELECT_FILTER);
manager.add(createComponent()
- .setInterface(Servlet.class.getName(), null)
+ .setInterface(Servlet.class.getName(), repositoryServletProps)
.setImplementation(RepositoryServlet.class)
- .add(createConfigurationDependency()
- .setPropagate(true)
- .setPid(REPOSITORY_PID))
.add(createServiceDependency()
.setService(LogService.class)
.setRequired(false)));
+ Properties replicationServletProps = new Properties();
+ replicationServletProps.put(HTTP_WHITEBOARD_SERVLET_PATTERN, "/replication/*");
+ replicationServletProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WHITEBOARD_CONTEXT_SELECT_FILTER);
manager.add(createComponent()
- .setInterface(Servlet.class.getName(), null)
+ .setInterface(Servlet.class.getName(), replicationServletProps)
.setImplementation(RepositoryReplicationServlet.class)
- .add(createConfigurationDependency()
- .setPropagate(true)
- .setPid(REPOSITORY_REPLICATION_PID))
.add(createServiceDependency()
.setService(LogService.class)
.setRequired(false)));
diff --git a/org.apache.ace.repository/src/org/apache/ace/repository/servlet/RepositoryServletBase.java b/org.apache.ace.repository/src/org/apache/ace/repository/servlet/RepositoryServletBase.java
index 180cec5..3a0c456 100644
--- a/org.apache.ace.repository/src/org/apache/ace/repository/servlet/RepositoryServletBase.java
+++ b/org.apache.ace.repository/src/org/apache/ace/repository/servlet/RepositoryServletBase.java
@@ -18,13 +18,10 @@
*/
package org.apache.ace.repository.servlet;
-import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED;
-
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
-import java.util.Dictionary;
import java.util.List;
import javax.servlet.ServletException;
@@ -32,25 +29,20 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.ace.authentication.api.AuthenticationService;
import org.apache.ace.range.SortedRangeSet;
-import org.apache.felix.dm.Component;
-import org.apache.felix.dm.DependencyManager;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
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;
/**
* Base class for the repository servlets. Both the repository and the repository replication servlets work in a similar
* way, so the specifics were factored out of this base class and put in two subclasses.
*/
-public abstract class RepositoryServletBase<REPO_TYPE> extends HttpServlet implements ManagedService {
- /** A boolean denoting whether or not authentication is enabled. */
- private static final String KEY_USE_AUTHENTICATION = "authentication.enabled";
+public abstract class RepositoryServletBase<REPO_TYPE> extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+
private static final int COPY_BUFFER_SIZE = 1024;
private static final String QUERY = "/query";
protected static final String TEXT_MIMETYPE = "text/plain";
@@ -58,9 +50,6 @@
private final Class<REPO_TYPE> m_repoType;
// injected by Dependency Manager
- private volatile DependencyManager m_dm;
- private volatile AuthenticationService m_authService;
- private volatile boolean m_useAuth = false;
protected volatile BundleContext m_context;
protected volatile LogService m_log;
@@ -68,21 +57,6 @@
m_repoType = repoType;
}
- 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;
- }
- }
-
/**
* Checkout or get data from the repository.
*
@@ -200,51 +174,6 @@
protected abstract SortedRangeSet getRange(REPO_TYPE repo) throws IOException;
/**
- * 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;
- }
-
- /**
* Copies data from an input stream to an output stream.
*
* @param in
diff --git a/org.apache.ace.useradmin.itest/bnd.bnd b/org.apache.ace.useradmin.itest/bnd.bnd
index 8c44d33..34064d2 100644
--- a/org.apache.ace.useradmin.itest/bnd.bnd
+++ b/org.apache.ace.useradmin.itest/bnd.bnd
@@ -29,7 +29,8 @@
org.apache.ace.repository.api;version=latest,\
org.apache.ace.repository.impl;version=latest,\
org.apache.ace.repository.servlets;version=latest,\
- org.apache.ace.useradmin.repository
+ org.apache.ace.useradmin.repository,\
+ org.apache.ace.http.context;version=latest
Private-Package: org.apache.ace.it.useradmin
Bundle-Version: 1.0.0
diff --git a/org.apache.ace.useradmin.itest/src/org/apache/ace/it/useradmin/UserAdminRepositoryTest.java b/org.apache.ace.useradmin.itest/src/org/apache/ace/it/useradmin/UserAdminRepositoryTest.java
index 89743b4..9487eb2 100644
--- a/org.apache.ace.useradmin.itest/src/org/apache/ace/it/useradmin/UserAdminRepositoryTest.java
+++ b/org.apache.ace.useradmin.itest/src/org/apache/ace/it/useradmin/UserAdminRepositoryTest.java
@@ -18,8 +18,6 @@
*/
package org.apache.ace.it.useradmin;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
-
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -161,10 +159,6 @@
protected void configureProvisionedServices() throws Exception {
m_host = new URL("http://localhost:" + TestConstants.PORT);
- configure("org.apache.ace.repository.servlet.RepositoryServlet",
- HTTP_WHITEBOARD_SERVLET_PATTERN, "/repository/*",
- "authentication.enabled", "false");
-
configureFactory("org.apache.ace.server.repository.factory",
"customer", "apache",
"name", "user",
@@ -176,6 +170,8 @@
"repositoryCustomer", "apache",
"repositoryName", "user");
+ configure("org.apache.ace.http.context", "authentication.enabled", "false");
+
Utils.waitForWebserver(m_host);
}
diff --git a/org.apache.ace.useradmin/test/aceDefault.xml b/org.apache.ace.useradmin/test/aceDefault.xml
index 0934b6b..bd9cf55 100644
--- a/org.apache.ace.useradmin/test/aceDefault.xml
+++ b/org.apache.ace.useradmin/test/aceDefault.xml
@@ -1,3 +1,4 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0). -->
<roles>
<group name="createArtifact">
<properties>
diff --git a/org.apache.ace.useradmin/test/current.xml b/org.apache.ace.useradmin/test/current.xml
index 2a4e665..b03b6b1 100644
--- a/org.apache.ace.useradmin/test/current.xml
+++ b/org.apache.ace.useradmin/test/current.xml
@@ -1 +1,2 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0). -->
<roles> <group name="createArtifact"> <properties> <type>permissionGroup</type> </properties> </group> <group name="updateArtifact"> <properties> <type>permissionGroup</type> </properties> </group> <group name="removeArtifact"> <properties> <type>permissionGroup</type> </properties> </group> <group name="viewArtifact"> <properties> <type>permissionGroup</type> </properties> </group> <group name="editArtifact"> <properties> <type>permissionGroup</type> </properties> </group> <group name="createFeature"> <properties> <type>permissionGroup</type> </properties> </group> <group name="removeFeature"> <properties> <type>permissionGroup</type> </properties> </group> <group name="associateArtifactToFeature"> <properties> <type>permissionGroup</type> </properties> </group> <group name="associateFeatureToDistribution"> <properties> <type>permissionGroup</type> </properties> </group> <group name="removeArtifactToFeatureAssociation"> <properties> <type>permissionGroup</type> </properties> </group> <group name="removeFeatureToDistributionAssociation"> <properties> <type>permissionGroup</type> </properties> </group> <group name="viewFeature"> <properties> <type>permissionGroup</type> </properties> </group> <group name="editFeature"> <properties> <type>permissionGroup</type> </properties> </group> <group name="viewDistribution"> <properties> <type>permissionGroup</type> </properties> </group> <group name="editDistribution"> <properties> <type>permissionGroup</type> </properties> </group> <group name="createDistribution"> <properties> <type>permissionGroup</type> </properties> </group> <group name="removeDistribution"> <properties> <type>permissionGroup</type> </properties> </group> <group name="associateDistributionToTarget"> <properties> <type>permissionGroup</type> </properties> </group> <group name="viewTarget"> <properties> <type>permissionGroup</type> </properties> </group> <group name="editTarget"> <properties> <type>permissionGroup</type> </properties> </group> <group name="createTarget"> <properties> <type>permissionGroup</type> </properties> </group> <group name="removeTarget"> <properties> <type>permissionGroup</type> </properties> </group> <group name="approveTarget"> <properties> <type>permissionGroup</type> </properties> </group> <group name="registerTarget"> <properties> <type>permissionGroup</type> </properties> </group> <group name="removeDistributionToTargetAssociation"> <properties> <type>permissionGroup</type> </properties> </group> <group name="mock"> <properties> <type>permissionGroup</type> </properties> </group> <group name="editUsers"> <properties> <type>permissionGroup</type> </properties> </group> <group name="TestGroup"> <properties> <type>userGroup</type> </properties> <memberof>createArtifact</memberof> <memberof>updateArtifact</memberof> <memberof>removeArtifact</memberof> <memberof>viewArtifact</memberof> <memberof>editArtifact</memberof> <memberof>createFeature</memberof> <memberof>removeFeature</memberof> <memberof>associateArtifactToFeature</memberof> <memberof>associateFeatureToDistribution</memberof> <memberof>removeArtifactToFeatureAssociation</memberof> <memberof>removeFeatureToDistributionAssociation</memberof> <memberof>viewFeature</memberof> <memberof>editFeature</memberof> <memberof>viewDistribution</memberof> <memberof>editDistribution</memberof> <memberof>createDistribution</memberof> <memberof>removeDistribution</memberof> <memberof>associateDistributionToTarget</memberof> <memberof>viewTarget</memberof> <memberof>editTarget</memberof> <memberof>createTarget</memberof> <memberof>removeTarget</memberof> <memberof>approveTarget</memberof> <memberof>registerTarget</memberof> <memberof>removeDistributionToTargetAssociation</memberof> <memberof>mock</memberof> <memberof>editUsers</memberof> </group> <group name="Target Operator"> <properties> <type>userGroup</type> </properties> <memberof>viewArtifact</memberof> <memberof>viewFeature</memberof> <memberof>viewDistribution</memberof> <memberof>viewTarget</memberof> <memberof>approveTarget</memberof> </group> <group name="Distribution Manager"> <properties> <type>userGroup</type> </properties> <memberof>viewArtifact</memberof> <memberof>viewFeature</memberof> <memberof>viewDistribution</memberof> <memberof>editDistribution</memberof> <memberof>createDistribution</memberof> <memberof>removeDistribution</memberof> <memberof>associateDistributionToTarget</memberof> <memberof>viewTarget</memberof> <memberof>removeDistributionToTargetAssociation</memberof> </group> <group name="Release Manager"> <properties> <type>userGroup</type> </properties> <memberof>createArtifact</memberof> <memberof>updateArtifact</memberof> <memberof>removeArtifact</memberof> <memberof>viewArtifact</memberof> <memberof>editArtifact</memberof> <memberof>createFeature</memberof> <memberof>removeFeature</memberof> <memberof>associateArtifactToFeature</memberof> <memberof>associateFeatureToDistribution</memberof> <memberof>removeArtifactToFeatureAssociation</memberof> <memberof>removeFeatureToDistributionAssociation</memberof> <memberof>viewFeature</memberof> <memberof>editFeature</memberof> <memberof>viewDistribution</memberof> <memberof>viewTarget</memberof> </group> <group name="Target Manager"> <properties> <type>userGroup</type> </properties> <memberof>viewArtifact</memberof> <memberof>viewFeature</memberof> <memberof>viewDistribution</memberof> <memberof>viewTarget</memberof> <memberof>editTarget</memberof> <memberof>createTarget</memberof> <memberof>removeTarget</memberof> <memberof>registerTarget</memberof> </group> <group name="External Distribution Manager"> <properties> <type>userGroup</type> </properties> <memberof>createArtifact</memberof> <memberof>updateArtifact</memberof> <memberof>removeArtifact</memberof> <memberof>viewArtifact</memberof> <memberof>editArtifact</memberof> <memberof>createFeature</memberof> <memberof>removeFeature</memberof> <memberof>associateArtifactToFeature</memberof> <memberof>associateFeatureToDistribution</memberof> <memberof>removeArtifactToFeatureAssociation</memberof> <memberof>removeFeatureToDistributionAssociation</memberof> <memberof>viewFeature</memberof> <memberof>editFeature</memberof> <memberof>viewDistribution</memberof> <memberof>editDistribution</memberof> <memberof>createDistribution</memberof> <memberof>removeDistribution</memberof> <memberof>associateDistributionToTarget</memberof> <memberof>viewTarget</memberof> <memberof>editTarget</memberof> <memberof>createTarget</memberof> <memberof>removeTarget</memberof> <memberof>approveTarget</memberof> <memberof>registerTarget</memberof> <memberof>removeDistributionToTargetAssociation</memberof> <memberof>mock</memberof> </group> <user name="d"> <properties> <username>d</username> </properties> <credentials> <password>f</password> </credentials> <memberof>TestGroup</memberof> </user> <user name="lm"> <properties> <username>lm</username> </properties> <credentials> <password>lm</password> </credentials> <memberof>Distribution Manager</memberof> </user> <user name="go"> <properties> <username>go</username> </properties> <credentials> <password>go</password> </credentials> <memberof>Target Operator</memberof> </user> <user name="rm"> <properties> <username>rm</username> </properties> <credentials> <password>rm</password> </credentials> <memberof>Release Manager</memberof> </user> <user name="gm"> <properties> <username>gm</username> </properties> <credentials> <password>gm</password> </credentials> <memberof>Target Manager</memberof> </user> <user name="elm"> <properties> <username>elm</username> </properties> <credentials> <password>elm</password> </credentials> <memberof>External Distribution Manager</memberof> </user> </roles>
\ No newline at end of file
diff --git a/org.apache.ace.useradmin/test/org/apache/ace/useradmin/repository/xstream/XStreamTest.java b/org.apache.ace.useradmin/test/org/apache/ace/useradmin/repository/xstream/XStreamTest.java
index 9ee0894..c6df248 100644
--- a/org.apache.ace.useradmin/test/org/apache/ace/useradmin/repository/xstream/XStreamTest.java
+++ b/org.apache.ace.useradmin/test/org/apache/ace/useradmin/repository/xstream/XStreamTest.java
@@ -80,6 +80,8 @@
String outputString = sw.toString();
String validXmlFileString = new String(Files.readAllBytes(Paths.get("test/valid.xml")));
+ // Remove the comment...
+ validXmlFileString = validXmlFileString.replaceAll("<!--[^\r\n]+-->[\r\n]+", "");
assertEquals(outputString, validXmlFileString);
}
diff --git a/org.apache.ace.useradmin/test/valid.xml b/org.apache.ace.useradmin/test/valid.xml
index 4882a91..7fb0d3f 100644
--- a/org.apache.ace.useradmin/test/valid.xml
+++ b/org.apache.ace.useradmin/test/valid.xml
@@ -1,3 +1,5 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0). -->
+
<roles>
<group name="testgroup">
<properties>
diff --git a/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AceWebuiServletContextHelper.java b/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AceWebuiServletContextHelper.java
new file mode 100644
index 0000000..206d6b7
--- /dev/null
+++ b/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/AceWebuiServletContextHelper.java
@@ -0,0 +1,95 @@
+/*
+ * 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.webui.vaadin;
+
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH;
+
+import java.net.URL;
+import java.util.Dictionary;
+
+import org.apache.felix.dm.Component;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.osgi.service.http.context.ServletContextHelper;
+
+public class AceWebuiServletContextHelper extends ServletContextHelper implements ManagedService {
+ private static final String RESOURCE_PATH = "/VAADIN";
+
+ private static final String KEY_CONTEXT_PATH = "context.path";
+ private static final String DEFAULT_CONTEXT_PATH = "/";
+
+ // Managed by Felix DM...
+ private volatile BundleContext m_context;
+ private volatile Component m_component;
+
+ public AceWebuiServletContextHelper() {
+ super();
+ }
+
+ @Override
+ public URL getResource(String name) {
+ URL resource = null;
+ // fix for ACE-156
+ if (!name.startsWith("/")) {
+ name = "/".concat(name);
+ }
+
+ String prefix = RESOURCE_PATH.concat("/");
+ if (name.startsWith(prefix)) {
+ String originalName = name.replace("/ace/", "/reindeer/");
+
+ resource = m_context.getBundle().getEntry(originalName);
+ if (resource == null) {
+ // try to find the resource in the Vaadin bundle instead
+ resource = com.vaadin.Application.class.getResource(originalName);
+ }
+ }
+ return resource;
+ }
+
+ public void updated(Dictionary<String, ?> settings) throws ConfigurationException {
+ String contextPath = DEFAULT_CONTEXT_PATH;
+
+ if (settings != null) {
+ Object 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 '/'!");
+ }
+ }
+
+ updateContextPath(contextPath);
+ }
+
+ private void updateContextPath(String pattern) {
+ Dictionary<Object, Object> serviceProperties = m_component.getServiceProperties();
+ String currentPath = (String) serviceProperties.get(HTTP_WHITEBOARD_CONTEXT_PATH);
+ if (!pattern.equals(currentPath)) {
+ serviceProperties.put(HTTP_WHITEBOARD_CONTEXT_PATH, pattern);
+ m_component.setServiceProperties(serviceProperties);
+ }
+ }
+}
diff --git a/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java b/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java
index dc95470..cf4404a 100644
--- a/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java
+++ b/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/Activator.java
@@ -18,6 +18,13 @@
*/
package org.apache.ace.webui.vaadin;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX;
+import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
+
import java.util.Map;
import java.util.Properties;
@@ -29,7 +36,8 @@
import org.apache.felix.dm.DependencyManager;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
-import org.osgi.service.http.HttpService;
+import org.osgi.service.http.context.ServletContextHelper;
+import org.osgi.service.log.LogService;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
@@ -38,31 +46,39 @@
public class Activator extends DependencyActivatorBase {
private static final String PID = "org.apache.ace.webui.vaadin";
- @Override
- public void destroy(BundleContext context, DependencyManager manager) throws Exception {
- }
+ private static final String ACE_WEBUI_WHITEBOARD_CONTEXT_NAME = "org.apache.ace.webui";
+ private static final String ACE_WEBUI_WHITEBOARD_CONTEXT_SELECT_FILTER = "(" + HTTP_WHITEBOARD_CONTEXT_NAME + "=" + ACE_WEBUI_WHITEBOARD_CONTEXT_NAME + ")";
@Override
public void init(BundleContext context, DependencyManager manager) throws Exception {
+ Properties contextProps = new Properties();
+ contextProps.put(HTTP_WHITEBOARD_CONTEXT_NAME, ACE_WEBUI_WHITEBOARD_CONTEXT_NAME);
+ contextProps.put(HTTP_WHITEBOARD_CONTEXT_PATH, "/");
manager.add(createComponent()
- .setImplementation(VaadinResourceHandler.class)
- .add(createServiceDependency()
- .setService(HttpService.class)
- .setRequired(true)
- )
- );
-
+ .setInterface(ServletContextHelper.class.getName(), contextProps)
+ .setImplementation(AceWebuiServletContextHelper.class)
+ .add(createConfigurationDependency().setPid(PID))
+ .add(createServiceDependency().setService(LogService.class).setRequired(false)));
+
+ Properties resourceRegistrationProps = new Properties();
+ resourceRegistrationProps.put(HTTP_WHITEBOARD_RESOURCE_PREFIX, "/VAADIN");
+ resourceRegistrationProps.put(HTTP_WHITEBOARD_RESOURCE_PATTERN, "/VAADIN/*");
+ resourceRegistrationProps.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WEBUI_WHITEBOARD_CONTEXT_SELECT_FILTER);
+ manager.add(createComponent()
+ .setInterface(Object.class.getName(), resourceRegistrationProps)
+ .setImplementation(new Object()));
+
Properties props = new Properties();
// ACE-472 - put Vaadin in production mode...
props.put("init.productionMode", "true");
-
+ props.put(HTTP_WHITEBOARD_SERVLET_PATTERN, VaadinServlet.DEFAULT_SERVLET_ENDPOINT.concat("/*"));
+ props.put(HTTP_WHITEBOARD_CONTEXT_SELECT, ACE_WEBUI_WHITEBOARD_CONTEXT_SELECT_FILTER);
+
// register the main application for the ACE UI client
manager.add(createComponent()
.setInterface(Servlet.class.getName(), props)
.setImplementation(VaadinServlet.class)
- .add(createConfigurationDependency()
- .setPid(PID).setPropagate(true))
- );
+ .add(createConfigurationDependency().setPid(PID)));
props = new Properties();
props.put(UIExtensionFactory.EXTENSION_POINT_KEY, UIExtensionFactory.EXTENSION_POINT_VALUE_TARGET);
@@ -87,7 +103,6 @@
vl.addComponent(info);
return vl;
}
- })
- );
+ }));
}
}
diff --git a/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinResourceHandler.java b/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinResourceHandler.java
deleted file mode 100644
index 3fc5520..0000000
--- a/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinResourceHandler.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.webui.vaadin;
-
-import java.io.IOException;
-import java.net.URL;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.http.HttpContext;
-import org.osgi.service.http.HttpService;
-
-public class VaadinResourceHandler {
- private static final String RESOURCE_PATH = "/VAADIN";
-
- // Injected by Felix DM...
- private volatile HttpService m_http;
- private volatile BundleContext m_bundleContext;
-
- public void start() throws Exception {
- final HttpContext context = m_http.createDefaultHttpContext();
-
- m_http.registerResources(RESOURCE_PATH, RESOURCE_PATH, new HttpContext() {
- public String getMimeType(String name) {
- return context.getMimeType(name);
- }
-
- /**
- * ACE uses a slightly modified version of the 'reindeer' theme. To avoid having to copy all resources in
- * the Vaadin jar, we only override the files we changed and do replace the theme name 'ace' with 'reindeer'
- * before we go looking for the original files.
- *
- * When updating to a new Vaadin version, usually you need to copy the styles.css file from the original
- * archive again and append the ACE changes to the end, as this file tends to change considerably between
- * versions.
- */
- public URL getResource(String name) {
- URL resource = null;
- // fix for ACE-156
- if (!name.startsWith("/")) {
- name = "/".concat(name);
- }
-
- String prefix = RESOURCE_PATH.concat("/");
- if (name.startsWith(prefix)) {
- String originalName = name.replace("/ace/", "/reindeer/");
- resource = m_bundleContext.getBundle().getEntry(originalName);
- if (resource == null) {
- // try to find the resource in the Vaadin bundle instead
- resource = com.vaadin.Application.class.getResource(originalName);
- }
- }
- return resource;
- }
-
- public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) throws IOException {
- return context.handleSecurity(request, response);
- }
- });
- }
-
- public void stop() throws Exception {
- m_http.unregister(RESOURCE_PATH);
- }
-}
diff --git a/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java b/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java
index 57eb154..0c27a07 100644
--- a/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java
+++ b/org.apache.ace.webui.vaadin/src/org/apache/ace/webui/vaadin/VaadinServlet.java
@@ -18,8 +18,6 @@
*/
package org.apache.ace.webui.vaadin;
-import static org.osgi.service.http.whiteboard.HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN;
-
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Dictionary;
@@ -39,10 +37,10 @@
import com.vaadin.terminal.gwt.server.WebApplicationContext;
public class VaadinServlet extends AbstractApplicationServlet implements ManagedService {
+ public static final String DEFAULT_SERVLET_ENDPOINT = "/ace";
+
private static final long serialVersionUID = 1L;
- /** denotes what endpoint we're serving this servlet. */
- private static final String KEY_SERVLET_ENDPOINT = HTTP_WHITEBOARD_SERVLET_PATTERN;
/** A boolean denoting whether or not authentication is enabled. */
private static final String KEY_USE_AUTHENTICATION = "ui.authentication.enabled";
/** Name of the user to log in as. */
@@ -66,7 +64,6 @@
private static final URL DEFAULT_ACE_HOST;
private static final URL DEFAULT_OBR_URL;
private static final String DEFAULT_OBR_XML = "index.xml";
- private static final String DEFAULT_SERVLET_ENDPOINT = "/ace/*";
private static final int DEFAULT_SESSION_TIMEOUT = 300; // in seconds.
private static final double DEFAULT_CACHE_RATE = 1;
private static final int DEFAULT_PAGE_LENGTH = 100;
@@ -88,7 +85,6 @@
private volatile URL m_aceHost;
private volatile URL m_obrUrl;
private volatile String m_repositoryXML;
- private volatile String m_servletEndpoint;
private volatile int m_sessionTimeout;
private volatile double m_cacheRate;
private volatile int m_pageLength;
@@ -103,7 +99,6 @@
m_aceHost = DEFAULT_ACE_HOST;
m_obrUrl = DEFAULT_OBR_URL;
m_repositoryXML = DEFAULT_OBR_XML;
- m_servletEndpoint = DEFAULT_SERVLET_ENDPOINT;
m_sessionTimeout = DEFAULT_SESSION_TIMEOUT;
m_cacheRate = DEFAULT_CACHE_RATE;
m_pageLength = DEFAULT_PAGE_LENGTH;
@@ -117,7 +112,6 @@
URL aceHost = DEFAULT_ACE_HOST;
URL obrUrl = DEFAULT_OBR_URL;
String repositoryXML = DEFAULT_OBR_XML;
- String servletEndpoint = DEFAULT_SERVLET_ENDPOINT;
int sessionTimeout = DEFAULT_SESSION_TIMEOUT;
double cacheRate = DEFAULT_CACHE_RATE;
int pageLength = DEFAULT_PAGE_LENGTH;
@@ -129,7 +123,6 @@
aceHost = getURL(dictionary, KEY_ACE_HOST);
obrUrl = getURL(dictionary, KEY_OBR_URL);
repositoryXML = getOptionalString(dictionary, KEY_OBR_XML);
- servletEndpoint = getOptionalString(dictionary, KEY_SERVLET_ENDPOINT);
sessionTimeout = getInteger(dictionary, KEY_SESSION_TIMEOUT);
Double doubleValue = getOptionalDouble(dictionary, KEY_CACHE_RATE);
@@ -157,7 +150,6 @@
m_aceHost = aceHost;
m_obrUrl = obrUrl;
m_repositoryXML = repositoryXML;
- m_servletEndpoint = servletEndpoint;
m_sessionTimeout = sessionTimeout;
m_cacheRate = cacheRate;
m_pageLength = pageLength;
@@ -184,16 +176,16 @@
protected SystemMessages getSystemMessages() {
CustomizedSystemMessages msgs = new CustomizedSystemMessages();
msgs.setAuthenticationErrorNotificationEnabled(false);
- msgs.setAuthenticationErrorURL(m_servletEndpoint.concat("/?authenticationError"));
+ msgs.setAuthenticationErrorURL(DEFAULT_SERVLET_ENDPOINT.concat("/?authenticationError"));
msgs.setCommunicationErrorNotificationEnabled(false);
- msgs.setCommunicationErrorURL(m_servletEndpoint.concat("/?communicationError"));
+ msgs.setCommunicationErrorURL(DEFAULT_SERVLET_ENDPOINT.concat("/?communicationError"));
msgs.setCookiesDisabledNotificationEnabled(false);
- msgs.setCookiesDisabledURL(m_servletEndpoint.concat("/?cookiesDisabled"));
+ msgs.setCookiesDisabledURL(DEFAULT_SERVLET_ENDPOINT.concat("/?cookiesDisabled"));
msgs.setInternalErrorNotificationEnabled(false);
- msgs.setInternalErrorURL(m_servletEndpoint.concat("/?internalError"));
+ msgs.setInternalErrorURL(DEFAULT_SERVLET_ENDPOINT.concat("/?internalError"));
msgs.setOutOfSyncNotificationEnabled(false);
msgs.setSessionExpiredNotificationEnabled(false);
- msgs.setSessionExpiredURL(m_servletEndpoint.concat("/?sessionTimedOut"));
+ msgs.setSessionExpiredURL(DEFAULT_SERVLET_ENDPOINT.concat("/?sessionTimedOut"));
return msgs;
}
diff --git a/run-client/client.bndrun b/run-client/client.bndrun
index 52b96ab..3f184e3 100644
--- a/run-client/client.bndrun
+++ b/run-client/client.bndrun
@@ -50,7 +50,8 @@
org.apache.ace.useradmin.ui;version=latest,\
org.apache.ace.webui.vaadin;version=latest,\
org.apache.ace.gogo;version=latest,\
- org.apache.ace.feedback.common;version=latest
+ org.apache.ace.feedback.common;version=latest,\
+ org.apache.ace.http.context;version=latest
-runrepos: Workspace,\
Release
-runproperties: org.apache.felix.log.storeDebug=true,\
diff --git a/run-client/conf/org.apache.ace.client.rest.cfg b/run-client/conf/org.apache.ace.client.rest.cfg
index 9c4207a..1e841b6 100644
--- a/run-client/conf/org.apache.ace.client.rest.cfg
+++ b/run-client/conf/org.apache.ace.client.rest.cfg
@@ -1,4 +1,3 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/client/*
session.timeout=300
diff --git a/run-client/conf/org.apache.ace.gogo.servlet.cfg b/run-client/conf/org.apache.ace.http.context.cfg
similarity index 76%
rename from run-client/conf/org.apache.ace.gogo.servlet.cfg
rename to run-client/conf/org.apache.ace.http.context.cfg
index 9040c5c..0c11b82 100644
--- a/run-client/conf/org.apache.ace.gogo.servlet.cfg
+++ b/run-client/conf/org.apache.ace.http.context.cfg
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/gogo/*
-authentication.enabled=false
+context.path=/
+authentication.enabled=false
\ No newline at end of file
diff --git a/run-client/conf/org.apache.ace.useradmin.repository.cfg b/run-client/conf/org.apache.ace.useradmin.repository.cfg
index a84da31..ff92686 100644
--- a/run-client/conf/org.apache.ace.useradmin.repository.cfg
+++ b/run-client/conf/org.apache.ace.useradmin.repository.cfg
@@ -1,3 +1,5 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
repositoryname=user
repositoryCustomer=apache
repositoryLocation=http://${org.apache.ace.server}/repository
\ No newline at end of file
diff --git a/run-client/conf/org.apache.ace.webui.vaadin.cfg b/run-client/conf/org.apache.ace.webui.vaadin.cfg
index 1de963a..e56e94d 100644
--- a/run-client/conf/org.apache.ace.webui.vaadin.cfg
+++ b/run-client/conf/org.apache.ace.webui.vaadin.cfg
@@ -1,7 +1,8 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
# The endpoint of the Vaadin UI
-osgi.http.whiteboard.servlet.pattern = /ace/*
+context.path = /
+
# Vaadin UI settings
ui.authentication.enabled = true
ui.authentication.user.name = dd
diff --git a/run-client/conf/org.apache.ace.gogo.servlet.cfg b/run-obr/conf/org.apache.ace.http.context.cfg
similarity index 76%
copy from run-client/conf/org.apache.ace.gogo.servlet.cfg
copy to run-obr/conf/org.apache.ace.http.context.cfg
index 9040c5c..0c11b82 100644
--- a/run-client/conf/org.apache.ace.gogo.servlet.cfg
+++ b/run-obr/conf/org.apache.ace.http.context.cfg
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/gogo/*
-authentication.enabled=false
+context.path=/
+authentication.enabled=false
\ No newline at end of file
diff --git a/run-obr/conf/org.apache.ace.useradmin.repository.cfg b/run-obr/conf/org.apache.ace.useradmin.repository.cfg
index a84da31..ff92686 100644
--- a/run-obr/conf/org.apache.ace.useradmin.repository.cfg
+++ b/run-obr/conf/org.apache.ace.useradmin.repository.cfg
@@ -1,3 +1,5 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
repositoryname=user
repositoryCustomer=apache
repositoryLocation=http://${org.apache.ace.server}/repository
\ No newline at end of file
diff --git a/run-obr/obr.bndrun b/run-obr/obr.bndrun
index 52213f3..6e1e8e5 100644
--- a/run-obr/obr.bndrun
+++ b/run-obr/obr.bndrun
@@ -24,6 +24,7 @@
org.apache.ace.connectionfactory;version=latest,\
org.apache.ace.range.api;version=latest,\
org.apache.ace.repository.api;version=latest,\
+ org.apache.ace.http.context;version=latest,\
osgi.cmpn
-runrepos: Workspace,\
diff --git a/run-relay/conf/org.apache.ace.deployment.servlet.agent.cfg b/run-relay/conf/org.apache.ace.deployment.servlet.agent.cfg
index 7516b66..c74b2c2 100644
--- a/run-relay/conf/org.apache.ace.deployment.servlet.agent.cfg
+++ b/run-relay/conf/org.apache.ace.deployment.servlet.agent.cfg
@@ -1,7 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/agent/*
-# no authentication is used...
-authentication.enabled = false
# OBR settings
obr.url = http://${org.apache.ace.obr}/obr/
diff --git a/run-relay/conf/org.apache.ace.deployment.servlet.cfg b/run-relay/conf/org.apache.ace.deployment.servlet.cfg
deleted file mode 100644
index b8419e6..0000000
--- a/run-relay/conf/org.apache.ace.deployment.servlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/deployment/*
-authentication.enabled = false
diff --git a/run-client/conf/org.apache.ace.gogo.servlet.cfg b/run-relay/conf/org.apache.ace.http.context.cfg
similarity index 76%
copy from run-client/conf/org.apache.ace.gogo.servlet.cfg
copy to run-relay/conf/org.apache.ace.http.context.cfg
index 9040c5c..0c11b82 100644
--- a/run-client/conf/org.apache.ace.gogo.servlet.cfg
+++ b/run-relay/conf/org.apache.ace.http.context.cfg
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/gogo/*
-authentication.enabled=false
+context.path=/
+authentication.enabled=false
\ No newline at end of file
diff --git a/run-relay/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg b/run-relay/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
index 9f26839..a675022 100644
--- a/run-relay/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
+++ b/run-relay/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
@@ -1,5 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/auditlog/*
name = auditlog
-authentication.enabled = false
+endpoint=/auditlog
diff --git a/run-relay/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg b/run-relay/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
deleted file mode 100644
index 9705b44..0000000
--- a/run-relay/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/repository/*
-authentication.enabled = false
diff --git a/run-relay/conf/org.apache.ace.useradmin.repository.cfg b/run-relay/conf/org.apache.ace.useradmin.repository.cfg
index a84da31..ff92686 100644
--- a/run-relay/conf/org.apache.ace.useradmin.repository.cfg
+++ b/run-relay/conf/org.apache.ace.useradmin.repository.cfg
@@ -1,3 +1,5 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
repositoryname=user
repositoryCustomer=apache
repositoryLocation=http://${org.apache.ace.server}/repository
\ No newline at end of file
diff --git a/run-relay/relay.bndrun b/run-relay/relay.bndrun
index c27abaa..6617f27 100644
--- a/run-relay/relay.bndrun
+++ b/run-relay/relay.bndrun
@@ -39,7 +39,8 @@
org.apache.ace.repository.servlets;version=latest,\
org.apache.ace.repository.task;version=latest,\
org.apache.ace.scheduler.impl;version=latest,\
- org.apache.ace.useradmin.repository;version=latest
+ org.apache.ace.useradmin.repository;version=latest,\
+ org.apache.ace.http.context;version=latest
-runrepos: Workspace,\
Release
-runproperties: org.apache.felix.log.storeDebug=true,\
diff --git a/run-server-allinone/conf/org.apache.ace.client.rest.cfg b/run-server-allinone/conf/org.apache.ace.client.rest.cfg
index fd568cd..1e841b6 100644
--- a/run-server-allinone/conf/org.apache.ace.client.rest.cfg
+++ b/run-server-allinone/conf/org.apache.ace.client.rest.cfg
@@ -1,5 +1,3 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/client/*
-osgi.http.whiteboard.listener=true
session.timeout=300
diff --git a/run-server-allinone/conf/org.apache.ace.configurator.useradmin.task.UpdateUserAdminTask.cfg b/run-server-allinone/conf/org.apache.ace.configurator.useradmin.task.UpdateUserAdminTask.cfg
deleted file mode 100644
index 1195652..0000000
--- a/run-server-allinone/conf/org.apache.ace.configurator.useradmin.task.UpdateUserAdminTask.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-repositoryLocation = http://${org.apache.ace.server}/repository
-repositoryCustomer = apache
-repositoryName = user
diff --git a/run-server-allinone/conf/org.apache.ace.connectionfactory/server.cfg b/run-server-allinone/conf/org.apache.ace.connectionfactory/server.cfg
new file mode 100644
index 0000000..a96729e
--- /dev/null
+++ b/run-server-allinone/conf/org.apache.ace.connectionfactory/server.cfg
@@ -0,0 +1,7 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
+authentication.baseURL = http://${org.apache.ace.server}/
+authentication.type = none
+#authentication.user.name = d
+#authentication.user.password = f
+
diff --git a/run-server-allinone/conf/org.apache.ace.deployment.servlet.agent.cfg b/run-server-allinone/conf/org.apache.ace.deployment.servlet.agent.cfg
index bcd872c..c74b2c2 100644
--- a/run-server-allinone/conf/org.apache.ace.deployment.servlet.agent.cfg
+++ b/run-server-allinone/conf/org.apache.ace.deployment.servlet.agent.cfg
@@ -1,6 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/agent/*
# OBR settings
obr.url = http://${org.apache.ace.obr}/obr/
-authentication.enabled = false
diff --git a/run-server-allinone/conf/org.apache.ace.deployment.servlet.cfg b/run-server-allinone/conf/org.apache.ace.deployment.servlet.cfg
deleted file mode 100644
index b8419e6..0000000
--- a/run-server-allinone/conf/org.apache.ace.deployment.servlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/deployment/*
-authentication.enabled = false
diff --git a/run-server-allinone/conf/org.apache.ace.gogo.servlet.cfg b/run-server-allinone/conf/org.apache.ace.gogo.servlet.cfg
deleted file mode 100644
index 9040c5c..0000000
--- a/run-server-allinone/conf/org.apache.ace.gogo.servlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/gogo/*
-authentication.enabled=false
diff --git a/run-client/conf/org.apache.ace.gogo.servlet.cfg b/run-server-allinone/conf/org.apache.ace.http.context.cfg
similarity index 76%
copy from run-client/conf/org.apache.ace.gogo.servlet.cfg
copy to run-server-allinone/conf/org.apache.ace.http.context.cfg
index 9040c5c..0c11b82 100644
--- a/run-client/conf/org.apache.ace.gogo.servlet.cfg
+++ b/run-server-allinone/conf/org.apache.ace.http.context.cfg
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/gogo/*
-authentication.enabled=false
+context.path=/
+authentication.enabled=false
\ No newline at end of file
diff --git a/run-server-allinone/conf/org.apache.ace.http.redirector.factory/root-to-ace.cfg b/run-server-allinone/conf/org.apache.ace.http.redirector.factory/root-to-ace.cfg
index 95e4870..1eba8d7 100644
--- a/run-server-allinone/conf/org.apache.ace.http.redirector.factory/root-to-ace.cfg
+++ b/run-server-allinone/conf/org.apache.ace.http.redirector.factory/root-to-ace.cfg
@@ -1,4 +1,5 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
osgi.http.whiteboard.servlet.pattern=/
+osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=org.apache.ace.webui)
org.apache.ace.webui.vaadin.redirect=/ace/
diff --git a/run-server-allinone/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg b/run-server-allinone/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
index 9f26839..a675022 100644
--- a/run-server-allinone/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
+++ b/run-server-allinone/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
@@ -1,5 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/auditlog/*
name = auditlog
-authentication.enabled = false
+endpoint=/auditlog
diff --git a/run-server-allinone/conf/org.apache.ace.obr.servlet.cfg b/run-server-allinone/conf/org.apache.ace.obr.servlet.cfg
deleted file mode 100644
index 19bc459..0000000
--- a/run-server-allinone/conf/org.apache.ace.obr.servlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/obr/*
-authentication.enabled = false
diff --git a/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg b/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg
deleted file mode 100644
index 0ce530b..0000000
--- a/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/replication/*
-authentication.enabled = false
diff --git a/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg b/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
deleted file mode 100644
index 9705b44..0000000
--- a/run-server-allinone/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/repository/*
-authentication.enabled = false
diff --git a/run-server-allinone/conf/org.apache.ace.useradmin.repository.cfg b/run-server-allinone/conf/org.apache.ace.useradmin.repository.cfg
index a84da31..ff92686 100644
--- a/run-server-allinone/conf/org.apache.ace.useradmin.repository.cfg
+++ b/run-server-allinone/conf/org.apache.ace.useradmin.repository.cfg
@@ -1,3 +1,5 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
repositoryname=user
repositoryCustomer=apache
repositoryLocation=http://${org.apache.ace.server}/repository
\ No newline at end of file
diff --git a/run-server-allinone/conf/org.apache.ace.webui.vaadin.cfg b/run-server-allinone/conf/org.apache.ace.webui.vaadin.cfg
index 7b5bcd5..5a7b5c7 100644
--- a/run-server-allinone/conf/org.apache.ace.webui.vaadin.cfg
+++ b/run-server-allinone/conf/org.apache.ace.webui.vaadin.cfg
@@ -2,7 +2,8 @@
# The endpoint of the Vaadin UI
org.apache.ace.server.servlet.init.productionMode = true
-osgi.http.whiteboard.servlet.pattern = /ace/*
+context.path = /
+
# Vaadin UI settings
ui.authentication.enabled = true
ui.authentication.user.name = dd
diff --git a/run-server-allinone/server-allinone.bndrun b/run-server-allinone/server-allinone.bndrun
index 0ca7b07..3463b9a 100644
--- a/run-server-allinone/server-allinone.bndrun
+++ b/run-server-allinone/server-allinone.bndrun
@@ -36,6 +36,7 @@
org.apache.ace.deployment.servlet;version=latest,\
org.apache.ace.deployment.streamgenerator;version=latest,\
org.apache.ace.discovery.api;version=latest,\
+ org.apache.ace.http.context;version=latest,\
org.apache.ace.http.redirector;version=latest,\
org.apache.ace.log.api;version=latest,\
org.apache.ace.log.server.servlet;version=latest,\
diff --git a/run-server/conf/org.apache.ace.deployment.servlet.agent.cfg b/run-server/conf/org.apache.ace.deployment.servlet.agent.cfg
index bcd872c..c74b2c2 100644
--- a/run-server/conf/org.apache.ace.deployment.servlet.agent.cfg
+++ b/run-server/conf/org.apache.ace.deployment.servlet.agent.cfg
@@ -1,6 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/agent/*
# OBR settings
obr.url = http://${org.apache.ace.obr}/obr/
-authentication.enabled = false
diff --git a/run-server/conf/org.apache.ace.deployment.servlet.cfg b/run-server/conf/org.apache.ace.deployment.servlet.cfg
deleted file mode 100644
index b8419e6..0000000
--- a/run-server/conf/org.apache.ace.deployment.servlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/deployment/*
-authentication.enabled = false
diff --git a/run-client/conf/org.apache.ace.gogo.servlet.cfg b/run-server/conf/org.apache.ace.http.context.cfg
similarity index 76%
copy from run-client/conf/org.apache.ace.gogo.servlet.cfg
copy to run-server/conf/org.apache.ace.http.context.cfg
index 9040c5c..0c11b82 100644
--- a/run-client/conf/org.apache.ace.gogo.servlet.cfg
+++ b/run-server/conf/org.apache.ace.http.context.cfg
@@ -1,4 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/gogo/*
-authentication.enabled=false
+context.path=/
+authentication.enabled=false
\ No newline at end of file
diff --git a/run-server/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg b/run-server/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
index 9f26839..a675022 100644
--- a/run-server/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
+++ b/run-server/conf/org.apache.ace.log.server.servlet.factory/auditlog.cfg
@@ -1,5 +1,4 @@
# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-osgi.http.whiteboard.servlet.pattern=/auditlog/*
name = auditlog
-authentication.enabled = false
+endpoint=/auditlog
diff --git a/run-server/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg b/run-server/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg
deleted file mode 100644
index 0ce530b..0000000
--- a/run-server/conf/org.apache.ace.repository.servlet.RepositoryReplicationServlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/replication/*
-authentication.enabled = false
diff --git a/run-server/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg b/run-server/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
deleted file mode 100644
index 9705b44..0000000
--- a/run-server/conf/org.apache.ace.repository.servlet.RepositoryServlet.cfg
+++ /dev/null
@@ -1,4 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
-
-osgi.http.whiteboard.servlet.pattern=/repository/*
-authentication.enabled = false
diff --git a/run-server/conf/org.apache.ace.useradmin.repository.cfg b/run-server/conf/org.apache.ace.useradmin.repository.cfg
index a84da31..ff92686 100644
--- a/run-server/conf/org.apache.ace.useradmin.repository.cfg
+++ b/run-server/conf/org.apache.ace.useradmin.repository.cfg
@@ -1,3 +1,5 @@
+# Licensed to the Apache Software Foundation (ASF) under the terms of ASLv2 (http://www.apache.org/licenses/LICENSE-2.0).
+
repositoryname=user
repositoryCustomer=apache
repositoryLocation=http://${org.apache.ace.server}/repository
\ No newline at end of file
diff --git a/run-server/server.bndrun b/run-server/server.bndrun
index 2d65272..63c8f71 100644
--- a/run-server/server.bndrun
+++ b/run-server/server.bndrun
@@ -37,7 +37,8 @@
org.apache.ace.scheduler.impl;version=latest,\
org.apache.ace.log.server.store.api;version=latest,\
org.apache.ace.log.server.store.file;version=latest,\
- org.apache.ace.feedback.common;version=latest
+ org.apache.ace.feedback.common;version=latest,\
+ org.apache.ace.http.context;version=latest
-runrepos: Workspace,\
Release
-runproperties: org.apache.felix.log.storeDebug=true,\