You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2016/11/24 10:53:06 UTC

[02/50] [abbrv] aries-jax-rs-whiteboard git commit: Working similarly as the spec mandates

Working similarly as the spec mandates

Now it is creating a default application for every deployed standalone
resource. You can also deploy applications. For the moment you can only
register providers to registered applications and the support for the
filters and interceptor with the base url is missing.

Build is still not working properly. Should fix that.
There is an initialization error log but everything works.
Updated to latest CXF version.

Needs cleanup... a lot of code moved around. :-(


Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/87965d09
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/87965d09
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/87965d09

Branch: refs/heads/master
Commit: 87965d09da7dd0e677965f0e626938967d791e02
Parents: f040d02
Author: Carlos Sierra <ca...@liferay.com>
Authored: Tue Sep 6 18:11:28 2016 +0200
Committer: Carlos Sierra <ca...@liferay.com>
Committed: Tue Oct 4 15:46:54 2016 +0200

----------------------------------------------------------------------
 .../portal/rest/example/ExampleAddon.java       |  13 +-
 .../portal/rest/example/ExampleApplication.java |   7 +-
 .../portal/rest/example/ExampleFilter.java      |   3 +-
 portal-remote-cxf-common/bnd.bnd                |  18 +--
 portal-remote-cxf-common/build.gradle           |  18 +--
 .../portal-remote-cxf-common.iml                |  31 ++--
 portal-remote-cxf-jaxrs-common/bnd.bnd          |   9 +-
 portal-remote-cxf-jaxrs-common/build.gradle     |   8 +-
 .../portal-remote-cxf-jaxrs-common.iml          |  10 +-
 portal-remote-rest-extender/build.gradle        |   8 +-
 .../portal-remote-rest-extender.iml             |  11 +-
 .../AddonsServiceTrackerCustomizer.java         | 102 ++++++++++++
 .../ApplicationServiceTrackerCustomizer.java    | 151 ++++++++++++++++++
 .../activator/BusServiceTrackerCustomizer.java  |  57 ++++---
 .../activator/CXFJaxRsBundleActivator.java      |  87 +---------
 .../ServicesServiceTrackerCustomizer.java       | 105 ++++++++++++
 .../SingletonServiceTrackerCustomizer.java      | 159 +++++++++++++++++++
 .../SingletonsServiceTrackerCustomizer.java     | 102 ------------
 .../internal/CXFJaxRsServiceRegistrator.java    |  10 +-
 test-cxf/build.gradle                           |   1 +
 20 files changed, 638 insertions(+), 272 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleAddon.java
----------------------------------------------------------------------
diff --git a/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleAddon.java b/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleAddon.java
index 6061222..206aebc 100644
--- a/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleAddon.java
+++ b/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleAddon.java
@@ -16,16 +16,19 @@ package com.liferay.portal.rest.example;
 
 import org.osgi.service.component.annotations.Component;
 
+import javax.annotation.PostConstruct;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
 
 /**
  * @author Carlos Sierra Andr�s
  */
 @Component(
 	immediate = true,
-	property = "jaxrs.application.select=(component.name=com.liferay.portal.rest.example.ExampleApplication)",
+	property = "osgi.jaxrs.resource.base=/example-addon",
 	service = ExampleAddon.class
 )
 public class ExampleAddon {
@@ -36,4 +39,12 @@ public class ExampleAddon {
 		return "Hello " + name;
 	}
 
+	@PostConstruct
+	public void init() {
+		System.out.println("URIINFO: " + _uriInfo);
+	}
+
+	@Context
+	UriInfo _uriInfo;
+
 }

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleApplication.java
----------------------------------------------------------------------
diff --git a/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleApplication.java b/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleApplication.java
index ad8f4be..4c09a82 100644
--- a/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleApplication.java
+++ b/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleApplication.java
@@ -26,8 +26,11 @@ import java.util.Set;
 /**
  * @author Carlos Sierra Andr�s
  */
-@Component(immediate = true, service = Application.class)
-@ApplicationPath("/example")
+@Component(
+	immediate = true,
+	property = "osgi.jaxrs.application.base=/example-application",
+	service = Application.class
+)
 public class ExampleApplication extends Application {
 
 	@Override

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleFilter.java
----------------------------------------------------------------------
diff --git a/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleFilter.java b/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleFilter.java
index e7355a8..f5fdde3 100644
--- a/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleFilter.java
+++ b/example-jaxrs-application/src/main/java/com/liferay/portal/rest/example/ExampleFilter.java
@@ -26,7 +26,8 @@ import java.io.IOException;
  */
 @Component(
 	immediate = true,
-	property = "jaxrs.application.select=(component.name=com.liferay.portal.rest.example.ExampleApplication)")
+	property = "jaxrs.application.select=(component.name=com.liferay.portal.rest.example.ExampleApplication)"
+)
 @Provider
 public class ExampleFilter implements ContainerRequestFilter {
 

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-cxf-common/bnd.bnd
----------------------------------------------------------------------
diff --git a/portal-remote-cxf-common/bnd.bnd b/portal-remote-cxf-common/bnd.bnd
index bc51f74..3daca64 100644
--- a/portal-remote-cxf-common/bnd.bnd
+++ b/portal-remote-cxf-common/bnd.bnd
@@ -17,7 +17,7 @@ Bundle-Version: 2.0.6
 Export-Package:\
 	javax.wsdl.*;version="1.2",\
 	\
-	org.apache.cxf.*;version="3.0.3",\
+	org.apache.cxf.*;version="3.1.7",\
 	org.apache.ws.commons.schema.*;version="2.1.0"
 Import-Package:\
 	!com.sun.*,\
@@ -51,13 +51,13 @@ Import-Package:\
 Liferay-Releng-Module-Group-Description:
 Liferay-Releng-Module-Group-Title: Remote Service Engines
 -includeresource:\
-	lib/cxf-core.jar=cxf-core-3.0.3.jar,\
-	lib/cxf-rt-bindings-soap.jar=cxf-rt-bindings-soap-3.0.3.jar,\
-	lib/cxf-rt-databinding-jaxb.jar=cxf-rt-databinding-jaxb-3.0.3.jar,\
-	lib/cxf-rt-transports-http.jar=cxf-rt-transports-http-3.0.3.jar,\
-	lib/cxf-rt-wsdl.jar=cxf-rt-wsdl-3.0.3.jar,\
-	lib/cxf-tools-common.jar=cxf-tools-common-3.0.3.jar,\
-	lib/cxf-tools-validator.jar=cxf-tools-validator-3.0.3.jar,\
+	lib/cxf-core.jar=cxf-core-3.1.7.jar,\
+	lib/cxf-rt-bindings-soap.jar=cxf-rt-bindings-soap-3.1.7.jar,\
+	lib/cxf-rt-databinding-jaxb.jar=cxf-rt-databinding-jaxb-3.1.7.jar,\
+	lib/cxf-rt-transports-http.jar=cxf-rt-transports-http-3.1.7.jar,\
+	lib/cxf-rt-wsdl.jar=cxf-rt-wsdl-3.1.7.jar,\
+	lib/cxf-tools-common.jar=cxf-tools-common-3.1.7.jar,\
+	lib/cxf-tools-validator.jar=cxf-tools-validator-3.1.7.jar,\
 	lib/javax.annotation-api.jar=javax.annotation-api-1.2.jar,\
 	lib/wsdl4j.jar=wsdl4j-1.6.3.jar,\
-	lib/xmlschema-core.jar=xmlschema-core-2.1.0.jar
\ No newline at end of file
+	lib/xmlschema-core.jar=xmlschema-core-2.2.1.jar

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-cxf-common/build.gradle
----------------------------------------------------------------------
diff --git a/portal-remote-cxf-common/build.gradle b/portal-remote-cxf-common/build.gradle
index 54b78aa..f431c26 100644
--- a/portal-remote-cxf-common/build.gradle
+++ b/portal-remote-cxf-common/build.gradle
@@ -4,15 +4,15 @@ dependencies {
 	compile group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
 	compile group: 'javax.annotation', name: 'javax.annotation-api', version: '1.2'
 	compile group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
-	compile group: "org.apache.cxf", name: "cxf-core", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-bindings-soap", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-databinding-jaxb", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-transports-http", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-wsdl", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-tools-common", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-tools-validator", version: "3.0.3"
+	compile group: "org.apache.cxf", name: "cxf-core", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-bindings-soap", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-databinding-jaxb", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-transports-http", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-wsdl", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-tools-common", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-tools-validator", version: "3.1.7"
 	compile group: "org.apache.felix", name: "org.apache.felix.dependencymanager", version: "3.2.0"
-	compile group: "org.apache.ws.xmlschema", name: "xmlschema-core", version: "2.1.0"
+//	compile group: "org.apache.ws.xmlschema", name: "xmlschema-core", version: "2.1.0"
 	compile group: "org.codehaus.woodstox", name: "stax2-api", version: "3.1.4"
 	compile group: "org.codehaus.woodstox", name: "woodstox-core-asl", version: "4.4.1"
 	compile group: "org.osgi", name: "org.osgi.core", version: "5.0.0"
@@ -45,4 +45,4 @@ deployDependencies {
 
 	rename(/stax2-api-(.+)\.jar/, "org.codehaus.stax2" + renameSuffix)
 	rename(/woodstox-core-asl-(.+)\.jar/, "com.ctc.wstx" + renameSuffix)
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-cxf-common/portal-remote-cxf-common.iml
----------------------------------------------------------------------
diff --git a/portal-remote-cxf-common/portal-remote-cxf-common.iml b/portal-remote-cxf-common/portal-remote-cxf-common.iml
index caa6a56..6dae0c0 100644
--- a/portal-remote-cxf-common/portal-remote-cxf-common.iml
+++ b/portal-remote-cxf-common/portal-remote-cxf-common.iml
@@ -17,33 +17,30 @@
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="library" name="Gradle: biz.aQute.bnd:biz.aQute.bndlib:3.1.0" level="project" />
     <orderEntry type="library" name="Gradle: javax.servlet:javax.servlet-api:3.0.1" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-core:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-bindings-soap:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-databinding-jaxb:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-transports-http:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-wsdl:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-tools-common:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-tools-validator:3.0.3" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-core:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-bindings-soap:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-databinding-jaxb:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-transports-http:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-wsdl:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-tools-common:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-tools-validator:3.1.7" level="project" />
     <orderEntry type="library" name="Gradle: org.apache.felix:org.apache.felix.dependencymanager:3.2.0" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.ws.xmlschema:xmlschema-core:2.1.0" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.core:5.0.0" level="project" />
-    <orderEntry type="library" name="Gradle: org.osgi:org.osgi.service.component.annotations:1.3.0" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.service.http.whiteboard:1.0.0" level="project" />
     <orderEntry type="library" name="Gradle: org.slf4j:slf4j-api:1.7.2" level="project" />
     <orderEntry type="library" name="Gradle: wsdl4j:wsdl4j:1.6.3" level="project" />
-    <orderEntry type="library" name="Gradle: com.sun.xml.bind:jaxb-impl:2.1.14" level="project" />
-    <orderEntry type="library" name="Gradle: com.sun.xml.bind:jaxb-core:2.1.14" level="project" />
-    <orderEntry type="library" name="Gradle: asm:asm:3.3.1" level="project" />
     <orderEntry type="library" name="Gradle: org.apache.velocity:velocity:1.7" level="project" />
-    <orderEntry type="library" name="Gradle: com.sun.xml.bind:jaxb-xjc:2.1.14" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.compendium:4.2.0" level="project" />
     <orderEntry type="library" name="Gradle: javax.xml.stream:stax-api:1.0-2" level="project" />
-    <orderEntry type="library" name="Gradle: com.sun.xml.fastinfoset:FastInfoset:1.2.12" level="project" />
-    <orderEntry type="library" name="Gradle: javax.xml.bind:jaxb-api:2.1" level="project" />
-    <orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.1" level="project" />
     <orderEntry type="library" name="Gradle: commons-lang:commons-lang:2.4" level="project" />
-    <orderEntry type="library" name="Gradle: javax.activation:activation:1.1" level="project" />
+    <orderEntry type="library" name="Gradle: javax.annotation:javax.annotation-api:1.2" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.ws.xmlschema:xmlschema-core:2.2.1" level="project" />
+    <orderEntry type="library" name="Gradle: com.sun.xml.bind:jaxb-impl:2.2.11" level="project" />
+    <orderEntry type="library" name="Gradle: com.sun.xml.bind:jaxb-core:2.2.11" level="project" />
+    <orderEntry type="library" name="Gradle: org.ow2.asm:asm:5.0.4" level="project" />
+    <orderEntry type="library" name="Gradle: commons-collections:commons-collections:3.2.2" level="project" />
+    <orderEntry type="library" name="Gradle: com.sun.xml.bind:jaxb-xjc:2.2.11" level="project" />
   </component>
 </module>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-cxf-jaxrs-common/bnd.bnd
----------------------------------------------------------------------
diff --git a/portal-remote-cxf-jaxrs-common/bnd.bnd b/portal-remote-cxf-jaxrs-common/bnd.bnd
index 0db3e1f..34b55df 100644
--- a/portal-remote-cxf-jaxrs-common/bnd.bnd
+++ b/portal-remote-cxf-jaxrs-common/bnd.bnd
@@ -25,8 +25,7 @@ Import-Package:\
 	\
 	!org.apache.abdera.*,\
 	!org.apache.aries.*,\
-	!org.apache.cxf.aegis.*,\
-	!org.apache.cxf.ws.policy.*,\
+	!org.apache.cxf.*,\
 	!org.apache.neethi.*,\
 	!org.apache.velocity.*,\
 	!org.apache.xml.resolver.*,\
@@ -57,9 +56,9 @@ Provide-Capability:\
 		uses:="javax.json,javax.json.spi,javax.json.stream";\
 		version:Version=1
 -includeresource:\
-	lib/cxf-rt-frontend-jaxrs.jar=cxf-rt-frontend-jaxrs-3.0.3.jar,\
-	lib/cxf-rt-rs-extension-providers.jar=cxf-rt-rs-extension-providers-3.0.3.jar,\
+	lib/cxf-rt-frontend-jaxrs.jar=cxf-rt-frontend-jaxrs-3.1.7.jar,\
+	lib/cxf-rt-rs-extension-providers.jar=cxf-rt-rs-extension-providers-3.1.7.jar,\
 	lib/javax.annotation-api.jar=javax.annotation-api-1.2.jar,\
 	lib/javax.json-api.jar=javax.json-api-1.0.jar,\
 	lib/javax.ws.rs-api.jar=javax.ws.rs-api-2.0.1.jar,\
-	lib/jettison.jar=jettison-1.3.3.jar
\ No newline at end of file
+	lib/jettison.jar=jettison-1.3.3.jar

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-cxf-jaxrs-common/build.gradle
----------------------------------------------------------------------
diff --git a/portal-remote-cxf-jaxrs-common/build.gradle b/portal-remote-cxf-jaxrs-common/build.gradle
index 414473f..767a928 100644
--- a/portal-remote-cxf-jaxrs-common/build.gradle
+++ b/portal-remote-cxf-jaxrs-common/build.gradle
@@ -2,12 +2,12 @@ dependencies {
 	compile group: "javax.annotation", name: "javax.annotation-api", version: "1.2"
 	compile group: "javax.json", name: "javax.json-api", version: "1.0"
 	compile group: "javax.ws.rs", name: "javax.ws.rs-api", version: "2.0.1"
-	compile group: "org.apache.cxf", name: "cxf-core", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-frontend-jaxrs", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-rs-extension-providers", version: "3.0.3"
+	compile group: "org.apache.cxf", name: "cxf-core", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-frontend-jaxrs", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-rs-extension-providers", version: "3.1.7"
 	compile group: "org.apache.felix", name: "org.apache.felix.dependencymanager", version: "3.2.0"
 	compile group: "org.codehaus.jettison", name: "jettison", version: "1.3.3"
 	compile group: "org.osgi", name: "org.osgi.core", version: "5.0.0"
 	compile group: "org.osgi", name: "org.osgi.service.http", version: "1.2.1"
 	compile group: "org.osgi", name: "org.osgi.service.http.whiteboard", version: "1.0.0"
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-cxf-jaxrs-common/portal-remote-cxf-jaxrs-common.iml
----------------------------------------------------------------------
diff --git a/portal-remote-cxf-jaxrs-common/portal-remote-cxf-jaxrs-common.iml b/portal-remote-cxf-jaxrs-common/portal-remote-cxf-jaxrs-common.iml
index f88922f..d8085ca 100644
--- a/portal-remote-cxf-jaxrs-common/portal-remote-cxf-jaxrs-common.iml
+++ b/portal-remote-cxf-jaxrs-common/portal-remote-cxf-jaxrs-common.iml
@@ -17,19 +17,19 @@
     <orderEntry type="library" name="Gradle: javax.annotation:javax.annotation-api:1.2" level="project" />
     <orderEntry type="library" name="Gradle: javax.json:javax.json-api:1.0" level="project" />
     <orderEntry type="library" name="Gradle: javax.ws.rs:javax.ws.rs-api:2.0.1" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-core:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-rs-extension-providers:3.0.3" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-core:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-rs-extension-providers:3.1.7" level="project" />
     <orderEntry type="library" name="Gradle: org.apache.felix:org.apache.felix.dependencymanager:3.2.0" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.jettison:jettison:1.3.3" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.core:5.0.0" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.service.http:1.2.1" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.service.http.whiteboard:1.0.0" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.ws.xmlschema:xmlschema-core:2.1.0" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-transports-http:3.0.3" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-transports-http:3.1.7" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.compendium:4.2.0" level="project" />
     <orderEntry type="library" name="Gradle: stax:stax-api:1.0.1" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.ws.xmlschema:xmlschema-core:2.2.1" level="project" />
   </component>
 </module>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/build.gradle
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/build.gradle b/portal-remote-rest-extender/build.gradle
index a9913c1..1a59902 100644
--- a/portal-remote-rest-extender/build.gradle
+++ b/portal-remote-rest-extender/build.gradle
@@ -3,11 +3,11 @@ dependencies {
 	compile group: "com.liferay", name: "com.liferay.portal.remote.cxf.jaxrs.common", version: "2.0.0"
 	compile group: "com.liferay", name: "com.liferay.portal.remote.dependency.manager.tccl", version: "2.0.0"
 	compile group: "javax.ws.rs", name: "javax.ws.rs-api", version: "2.0.1"
-	compile group: "org.apache.cxf", name: "cxf-core", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-frontend-jaxrs", version: "3.0.3"
-	compile group: "org.apache.cxf", name: "cxf-rt-rs-extension-providers", version: "3.0.3"
+	compile group: "org.apache.cxf", name: "cxf-core", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-frontend-jaxrs", version: "3.1.7"
+	compile group: "org.apache.cxf", name: "cxf-rt-rs-extension-providers", version: "3.1.7"
 	compile group: "org.apache.felix", name: "org.apache.felix.dependencymanager", version: "3.2.0"
 	compile group: "org.codehaus.jettison", name: "jettison", version: "1.3.3"
 	compile group: "org.osgi", name: "org.osgi.core", version: "5.0.0"
 	compile group: "org.osgi", name: "org.osgi.service.http.whiteboard", version: "1.0.0"
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/portal-remote-rest-extender.iml
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/portal-remote-rest-extender.iml b/portal-remote-rest-extender/portal-remote-rest-extender.iml
index 324cd07..d376453 100644
--- a/portal-remote-rest-extender/portal-remote-rest-extender.iml
+++ b/portal-remote-rest-extender/portal-remote-rest-extender.iml
@@ -19,20 +19,19 @@
     <orderEntry type="library" name="Gradle: com.liferay:com.liferay.portal.remote.cxf.jaxrs.common:2.0.0" level="project" />
     <orderEntry type="library" name="Gradle: com.liferay:com.liferay.portal.remote.dependency.manager.tccl:2.0.0" level="project" />
     <orderEntry type="library" name="Gradle: javax.ws.rs:javax.ws.rs-api:2.0.1" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-core:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.3" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-rs-extension-providers:3.0.3" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-core:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-frontend-jaxrs:3.1.7" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-rs-extension-providers:3.1.7" level="project" />
     <orderEntry type="library" name="Gradle: org.apache.felix:org.apache.felix.dependencymanager:3.2.0" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.jettison:jettison:1.3.3" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.core:5.0.0" level="project" />
-    <orderEntry type="library" name="Gradle: org.osgi:org.osgi.service.component.annotations:1.3.0" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.service.http.whiteboard:1.0.0" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.woodstox:woodstox-core-asl:4.4.1" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.ws.xmlschema:xmlschema-core:2.1.0" level="project" />
     <orderEntry type="library" name="Gradle: javax.annotation:javax.annotation-api:1.2" level="project" />
-    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-transports-http:3.0.3" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.cxf:cxf-rt-transports-http:3.1.7" level="project" />
     <orderEntry type="library" name="Gradle: org.osgi:org.osgi.compendium:4.2.0" level="project" />
     <orderEntry type="library" name="Gradle: stax:stax-api:1.0.1" level="project" />
     <orderEntry type="library" name="Gradle: org.codehaus.woodstox:stax2-api:3.1.4" level="project" />
+    <orderEntry type="library" name="Gradle: org.apache.ws.xmlschema:xmlschema-core:2.2.1" level="project" />
   </component>
 </module>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/AddonsServiceTrackerCustomizer.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/AddonsServiceTrackerCustomizer.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/AddonsServiceTrackerCustomizer.java
new file mode 100644
index 0000000..c255313
--- /dev/null
+++ b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/AddonsServiceTrackerCustomizer.java
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
+ * <p>
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * <p>
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+package com.liferay.portal.remote.rest.extender.activator;
+
+import com.liferay.portal.remote.rest.extender.internal.CXFJaxRsServiceRegistrator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+import javax.ws.rs.ext.Provider;
+
+/**
+ * @author Carlos Sierra Andr�s
+ */
+public class AddonsServiceTrackerCustomizer
+	implements ServiceTrackerCustomizer<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator> {
+
+	private final BundleContext _bundleContext;
+	private final ClassLoader _classLoader;
+	private final Class<?> _serviceClass;
+	private final Object _service;
+
+	public AddonsServiceTrackerCustomizer(
+		BundleContext bundleContext, ClassLoader classLoader,
+		Object service) {
+
+		_bundleContext = bundleContext;
+		_classLoader = classLoader;
+		_service = service;
+
+		_serviceClass = service.getClass();
+	}
+
+	@Override
+	public CXFJaxRsServiceRegistrator addingService(
+		ServiceReference<CXFJaxRsServiceRegistrator> reference) {
+
+		Thread thread = Thread.currentThread();
+
+		ClassLoader contextClassLoader =
+			thread.getContextClassLoader();
+
+		CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator =
+			_bundleContext.getService(reference);
+
+		try {
+			thread.setContextClassLoader(_classLoader);
+
+			if (_serviceClass.isAnnotationPresent(Provider.class)) {
+				cxfJaxRsServiceRegistrator.addProvider(_service);
+			} else {
+				cxfJaxRsServiceRegistrator.addService(_service);
+			}
+
+			return cxfJaxRsServiceRegistrator;
+		}
+		catch (Exception e) {
+			_bundleContext.ungetService(reference);
+
+			throw e;
+		}
+		finally {
+			thread.setContextClassLoader(contextClassLoader);
+		}
+	}
+
+	@Override
+	public void modifiedService(
+		ServiceReference<CXFJaxRsServiceRegistrator> reference,
+		CXFJaxRsServiceRegistrator registrator) {
+
+		removedService(reference, registrator);
+
+		addingService(reference);
+	}
+
+	@Override
+	public void removedService(
+		ServiceReference<CXFJaxRsServiceRegistrator> reference,
+		CXFJaxRsServiceRegistrator registrator) {
+
+		if (_serviceClass.isAnnotationPresent(Provider.class)) {
+			registrator.removeProvider(_service);
+		} else {
+			registrator.removeService(_service);
+		}
+
+		_bundleContext.ungetService(reference);
+	}
+}

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ApplicationServiceTrackerCustomizer.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ApplicationServiceTrackerCustomizer.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ApplicationServiceTrackerCustomizer.java
new file mode 100644
index 0000000..b554cf5
--- /dev/null
+++ b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ApplicationServiceTrackerCustomizer.java
@@ -0,0 +1,151 @@
+/**
+ * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
+ * <p>
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * <p>
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+package com.liferay.portal.remote.rest.extender.activator;
+
+import com.liferay.portal.remote.rest.extender.internal.CXFJaxRsServiceRegistrator;
+import org.apache.cxf.Bus;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+import javax.ws.rs.core.Application;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * @author Carlos Sierra Andr�s
+ */
+class ApplicationServiceTrackerCustomizer
+	implements ServiceTrackerCustomizer
+		<Application, ApplicationServiceTrackerCustomizer.Tracked> {
+
+	private BundleContext _bundleContext;
+	private Bus _bus;
+
+	public ApplicationServiceTrackerCustomizer(
+		BundleContext bundleContext, Bus bus) {
+
+		_bundleContext = bundleContext;
+		_bus = bus;
+	}
+
+	@Override
+	public Tracked addingService(
+		ServiceReference<Application> serviceReference) {
+
+		Application application = _bundleContext.getService(
+			serviceReference);
+
+		try {
+			String[] propertyKeys = serviceReference.getPropertyKeys();
+
+			Map<String, Object> properties = new HashMap<>(
+				propertyKeys.length);
+
+			for (String propertyKey : propertyKeys) {
+				properties.put(
+					propertyKey, serviceReference.getProperty(propertyKey));
+			}
+
+			properties.put(
+				"CXF_ENDPOINT_ADDRESS",
+				serviceReference.getProperty("osgi.jaxrs.application.base").
+					toString());
+
+			CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator =
+				new CXFJaxRsServiceRegistrator(properties);
+
+			cxfJaxRsServiceRegistrator.addBus(_bus);
+			cxfJaxRsServiceRegistrator.addApplication(application);
+
+			return new Tracked(
+				cxfJaxRsServiceRegistrator, application,
+				_bundleContext.registerService(
+					CXFJaxRsServiceRegistrator.class,
+					cxfJaxRsServiceRegistrator, new Hashtable<>(properties)));
+		}
+		catch (Exception e) {
+			_bundleContext.ungetService(serviceReference);
+
+			throw e;
+		}
+	}
+
+	@Override
+	public void modifiedService(
+		ServiceReference<Application> serviceReference, Tracked tracked) {
+
+		removedService(serviceReference, tracked);
+		addingService(serviceReference);
+	}
+
+	@Override
+	public void removedService(
+		ServiceReference<Application> reference, Tracked tracked) {
+
+		_bundleContext.ungetService(reference);
+
+		Application application = tracked.getApplication();
+
+		CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator =
+			tracked.getCxfJaxRsServiceRegistrator();
+
+		cxfJaxRsServiceRegistrator.removeApplication(application);
+
+		cxfJaxRsServiceRegistrator.removeBus(_bus);
+
+		tracked.getCxfJaxRsServiceRegistratorServiceRegistration().unregister();
+	}
+
+	public static class Tracked {
+
+		private final CXFJaxRsServiceRegistrator _cxfJaxRsServiceRegistrator;
+		private final Application _application;
+		private final ServiceRegistration<CXFJaxRsServiceRegistrator>
+			_cxfJaxRsServiceRegistratorServiceRegistration;
+
+		public Application getApplication() {
+			return _application;
+		}
+
+		public CXFJaxRsServiceRegistrator getCxfJaxRsServiceRegistrator() {
+			return _cxfJaxRsServiceRegistrator;
+		}
+
+		public ServiceRegistration<CXFJaxRsServiceRegistrator>
+			getCxfJaxRsServiceRegistratorServiceRegistration() {
+
+			return _cxfJaxRsServiceRegistratorServiceRegistration;
+		}
+
+		public Tracked(
+			CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator,
+			Application application,
+			ServiceRegistration<CXFJaxRsServiceRegistrator>
+				cxfJaxRsServiceRegistratorServiceRegistration) {
+
+			_cxfJaxRsServiceRegistrator = cxfJaxRsServiceRegistrator;
+			_application = application;
+			_cxfJaxRsServiceRegistratorServiceRegistration =
+				cxfJaxRsServiceRegistratorServiceRegistration;
+		}
+
+	}
+}
+
+

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/BusServiceTrackerCustomizer.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/BusServiceTrackerCustomizer.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/BusServiceTrackerCustomizer.java
index 45f0067..6832b18 100644
--- a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/BusServiceTrackerCustomizer.java
+++ b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/BusServiceTrackerCustomizer.java
@@ -16,46 +16,52 @@ package com.liferay.portal.remote.rest.extender.activator;
 
 import org.apache.cxf.Bus;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
 import javax.ws.rs.core.Application;
+import java.util.Arrays;
+import java.util.Collection;
 
 /**
  * @author Carlos Sierra Andr�s
  */
 public class BusServiceTrackerCustomizer
-	implements ServiceTrackerCustomizer<Bus, ServiceTracker<Application,
-		ApplicationServiceTrackerCustomizer.Tracked>> {
+	implements ServiceTrackerCustomizer<Bus, Collection<ServiceTracker<?, ?>>> {
 
 	private BundleContext _bundleContext;
 
-	public BusServiceTrackerCustomizer(
-		BundleContext bundleContext) {
-
+	public BusServiceTrackerCustomizer(BundleContext bundleContext) {
 		_bundleContext = bundleContext;
 	}
 
 	@Override
-	public ServiceTracker
-		<Application, ApplicationServiceTrackerCustomizer.Tracked>
+	public Collection<ServiceTracker<?, ?>>
 	addingService(ServiceReference<Bus> serviceReference) {
 
 		Bus bus = _bundleContext.getService(serviceReference);
 
 		try {
-			ServiceTracker
-				<Application,
-					ApplicationServiceTrackerCustomizer.Tracked>
-				applicationTracker =
-				new ServiceTracker<>(_bundleContext, Application.class,
+			ServiceTracker<Application,?> applicationTracker =
+				new ServiceTracker<>(_bundleContext, getApplicationFilter(),
 					new ApplicationServiceTrackerCustomizer(
 						_bundleContext, bus));
 
 			applicationTracker.open();
 
-			return applicationTracker;
+			ServiceTracker<Object, ?> singletonsServiceTracker =
+				new ServiceTracker<>(_bundleContext, getSingletonsFilter(),
+					new SingletonServiceTrackerCustomizer(_bundleContext, bus));
+
+			singletonsServiceTracker.open();
+
+			return Arrays.asList(applicationTracker, singletonsServiceTracker);
+		}
+		catch (InvalidSyntaxException ise) {
+			throw new RuntimeException(ise);
 		}
 		catch (Exception e) {
 			_bundleContext.ungetService(serviceReference);
@@ -64,14 +70,22 @@ public class BusServiceTrackerCustomizer
 		}
 	}
 
+	private Filter getApplicationFilter() throws InvalidSyntaxException {
+		return _bundleContext.createFilter(
+			"(&(objectClass=" + Application.class.getName() + ")" +
+				"(osgi.jaxrs.application.base=*))");
+	}
+
+	private Filter getSingletonsFilter() throws InvalidSyntaxException {
+		return _bundleContext.createFilter("(osgi.jaxrs.resource.base=*)");
+	}
+
 	@Override
 	public void modifiedService(
 		ServiceReference<Bus> reference,
-		ServiceTracker
-			<Application, ApplicationServiceTrackerCustomizer.Tracked>
-			service) {
+		Collection<ServiceTracker<?, ?>> serviceTrackers) {
 
-		removedService(reference, service);
+		removedService(reference, serviceTrackers);
 
 		addingService(reference);
 	}
@@ -79,12 +93,13 @@ public class BusServiceTrackerCustomizer
 	@Override
 	public void removedService(
 		ServiceReference<Bus> serviceReference,
-		ServiceTracker
-			<Application, ApplicationServiceTrackerCustomizer.Tracked>
-			serviceTracker) {
+		Collection<ServiceTracker<?, ?>> serviceTrackers) {
 
 		_bundleContext.ungetService(serviceReference);
 
-		serviceTracker.close();
+		for (ServiceTracker<?, ?> serviceTracker : serviceTrackers) {
+			serviceTracker.close();
+		}
 	}
+
 }

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/CXFJaxRsBundleActivator.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/CXFJaxRsBundleActivator.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/CXFJaxRsBundleActivator.java
index 999f29e..6950277 100644
--- a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/CXFJaxRsBundleActivator.java
+++ b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/CXFJaxRsBundleActivator.java
@@ -14,28 +14,21 @@
 
 package com.liferay.portal.remote.rest.extender.activator;
 
-import javax.ws.rs.core.Application;
 import javax.ws.rs.ext.RuntimeDelegate;
 
-import com.liferay.portal.remote.rest.extender.internal.CXFJaxRsServiceRegistrator;
 import org.apache.cxf.Bus;
-import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.wiring.BundleWiring;
 import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
 /**
  * @author Carlos Sierra Andr�s
  */
 public class CXFJaxRsBundleActivator implements BundleActivator {
 
-	private ServiceTracker<Object, ServiceTracker<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>> _singletonsTracker;
-	private ServiceTracker<Bus, ServiceTracker<Application, ApplicationServiceTrackerCustomizer.Tracked>> _busServiceTracker;
+	private ServiceTracker<?, ?> _singletonsTracker;
+	private ServiceTracker<?, ?> _busServiceTracker;
 
 	@Override
 	public void start(BundleContext bundleContext) throws Exception {
@@ -80,80 +73,4 @@ public class CXFJaxRsBundleActivator implements BundleActivator {
 		_busServiceTracker.close();
 	}
 
-	private static class ServicesServiceTrackerCustomizer
-		implements ServiceTrackerCustomizer
-			<Object, ServiceTracker
-				<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>> {
-
-		private final BundleContext _bundleContext;
-
-		public ServicesServiceTrackerCustomizer(BundleContext bundleContext) {
-			_bundleContext = bundleContext;
-		}
-
-		@Override
-		public ServiceTracker
-			<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
-				addingService(ServiceReference<Object> reference) {
-
-			String applicationSelector =
-				reference.getProperty("jaxrs.application.select").toString();
-
-			Bundle bundle = reference.getBundle();
-
-			BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
-
-			ClassLoader classLoader = bundleWiring.getClassLoader();
-
-			Object service = _bundleContext.getService(reference);
-
-			try {
-				Filter filter = _bundleContext.createFilter(
-					"(&(objectClass=" + CXFJaxRsServiceRegistrator.class.getName() + ")" +
-						applicationSelector + ")");
-
-				ServiceTracker
-					<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
-						serviceTracker = new ServiceTracker<>(
-							_bundleContext, filter,
-							new SingletonsServiceTrackerCustomizer(
-								_bundleContext, classLoader,
-								service));
-
-				serviceTracker.open();
-
-				return serviceTracker;
-			}
-			catch (InvalidSyntaxException ise) {
-				_bundleContext.ungetService(reference);
-
-				throw new RuntimeException(ise);
-			}
-		}
-
-		@Override
-		public void modifiedService(
-			ServiceReference<Object> reference,
-			ServiceTracker
-				<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
-					serviceTracker) {
-
-			removedService(reference, serviceTracker);
-
-			addingService(reference);
-		}
-
-		@Override
-		public void removedService(
-			ServiceReference<Object> reference,
-			ServiceTracker
-				<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
-				serviceTracker) {
-
-			serviceTracker.close();
-
-			_bundleContext.ungetService(reference);
-		}
-
-	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ServicesServiceTrackerCustomizer.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ServicesServiceTrackerCustomizer.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ServicesServiceTrackerCustomizer.java
new file mode 100644
index 0000000..df57cc6
--- /dev/null
+++ b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/ServicesServiceTrackerCustomizer.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
+ * <p>
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * <p>
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+package com.liferay.portal.remote.rest.extender.activator;
+
+import com.liferay.portal.remote.rest.extender.internal.CXFJaxRsServiceRegistrator;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+/**
+ * @author Carlos Sierra Andr�s
+ */
+class ServicesServiceTrackerCustomizer
+	implements ServiceTrackerCustomizer
+		<Object, ServiceTracker
+			<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>> {
+
+	private final BundleContext _bundleContext;
+
+	public ServicesServiceTrackerCustomizer(BundleContext bundleContext) {
+		_bundleContext = bundleContext;
+	}
+
+	@Override
+	public ServiceTracker
+		<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
+	addingService(ServiceReference<Object> reference) {
+
+		String applicationSelector =
+			reference.getProperty("jaxrs.application.select").toString();
+
+		Bundle bundle = reference.getBundle();
+
+		BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
+
+		ClassLoader classLoader = bundleWiring.getClassLoader();
+
+		Object service = _bundleContext.getService(reference);
+
+		try {
+			Filter filter = _bundleContext.createFilter(
+				"(&(objectClass=" + CXFJaxRsServiceRegistrator.class.getName() + ")" +
+					applicationSelector + ")");
+
+			ServiceTracker
+				<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
+				serviceTracker = new ServiceTracker<>(
+				_bundleContext, filter,
+				new AddonsServiceTrackerCustomizer(
+					_bundleContext, classLoader,
+					service));
+
+			serviceTracker.open();
+
+			return serviceTracker;
+		}
+		catch (InvalidSyntaxException ise) {
+			_bundleContext.ungetService(reference);
+
+			throw new RuntimeException(ise);
+		}
+	}
+
+	@Override
+	public void modifiedService(
+		ServiceReference<Object> reference,
+		ServiceTracker
+			<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
+			serviceTracker) {
+
+		removedService(reference, serviceTracker);
+
+		addingService(reference);
+	}
+
+	@Override
+	public void removedService(
+		ServiceReference<Object> reference,
+		ServiceTracker
+			<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator>
+			serviceTracker) {
+
+		serviceTracker.close();
+
+		_bundleContext.ungetService(reference);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonServiceTrackerCustomizer.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonServiceTrackerCustomizer.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonServiceTrackerCustomizer.java
new file mode 100644
index 0000000..e65f3a2
--- /dev/null
+++ b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonServiceTrackerCustomizer.java
@@ -0,0 +1,159 @@
+/**
+ * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
+ * <p>
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ * <p>
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+package com.liferay.portal.remote.rest.extender.activator;
+
+import com.liferay.portal.remote.rest.extender.internal.CXFJaxRsServiceRegistrator;
+import org.apache.cxf.Bus;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+import javax.ws.rs.core.Application;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Carlos Sierra Andr�s
+ */
+class SingletonServiceTrackerCustomizer
+	implements ServiceTrackerCustomizer
+		<Object, SingletonServiceTrackerCustomizer.Tracked> {
+
+	private BundleContext _bundleContext;
+	private Bus _bus;
+
+	public SingletonServiceTrackerCustomizer(
+		BundleContext bundleContext, Bus bus) {
+
+		_bundleContext = bundleContext;
+		_bus = bus;
+	}
+
+	@Override
+	public Tracked addingService(
+		ServiceReference<Object> serviceReference) {
+
+		final Object service = _bundleContext.getService(
+			serviceReference);
+
+		try {
+			String[] propertyKeys = serviceReference.getPropertyKeys();
+
+			Map<String, Object> properties = new HashMap<>(
+				propertyKeys.length);
+
+			for (String propertyKey : propertyKeys) {
+				properties.put(
+					propertyKey, serviceReference.getProperty(propertyKey));
+			}
+
+			properties.put(
+				"CXF_ENDPOINT_ADDRESS",
+				serviceReference.getProperty("osgi.jaxrs.resource.base").
+					toString());
+
+			CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator =
+				new CXFJaxRsServiceRegistrator(properties);
+
+			cxfJaxRsServiceRegistrator.addBus(_bus);
+			cxfJaxRsServiceRegistrator.addApplication(new Application() {
+				@Override
+				public Set<Object> getSingletons() {
+					return Collections.singleton(service);
+				}
+			});
+
+			return new Tracked(
+				cxfJaxRsServiceRegistrator, service,
+				_bundleContext.registerService(
+					CXFJaxRsServiceRegistrator.class,
+					cxfJaxRsServiceRegistrator, new Hashtable<>(properties)));
+		}
+		catch (Exception e) {
+			_bundleContext.ungetService(serviceReference);
+
+			throw e;
+		}
+	}
+
+	@Override
+	public void modifiedService(
+		ServiceReference<Object> serviceReference, Tracked tracked) {
+
+		removedService(serviceReference, tracked);
+
+		addingService(serviceReference);
+	}
+
+	@Override
+	public void removedService(
+		ServiceReference<Object> reference, Tracked tracked) {
+
+		_bundleContext.ungetService(reference);
+
+		Object service = tracked.getService();
+
+		CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator =
+			tracked.getCxfJaxRsServiceRegistrator();
+
+		cxfJaxRsServiceRegistrator.removeService(service);
+
+		cxfJaxRsServiceRegistrator.removeBus(_bus);
+
+		tracked.getCxfJaxRsServiceRegistratorServiceRegistration().unregister();
+	}
+
+	public static class Tracked {
+
+		private final CXFJaxRsServiceRegistrator _cxfJaxRsServiceRegistrator;
+		private final Object _service;
+		private final ServiceRegistration<CXFJaxRsServiceRegistrator>
+			_cxfJaxRsServiceRegistratorServiceRegistration;
+
+		public Object getService() {
+			return _service;
+		}
+
+		public CXFJaxRsServiceRegistrator getCxfJaxRsServiceRegistrator() {
+			return _cxfJaxRsServiceRegistrator;
+		}
+
+		public ServiceRegistration<CXFJaxRsServiceRegistrator>
+			getCxfJaxRsServiceRegistratorServiceRegistration() {
+
+			return _cxfJaxRsServiceRegistratorServiceRegistration;
+		}
+
+		public Tracked(
+			CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator,
+			Object service,
+			ServiceRegistration<CXFJaxRsServiceRegistrator>
+				cxfJaxRsServiceRegistratorServiceRegistration) {
+
+			_cxfJaxRsServiceRegistrator = cxfJaxRsServiceRegistrator;
+			_service = service;
+			_cxfJaxRsServiceRegistratorServiceRegistration =
+				cxfJaxRsServiceRegistratorServiceRegistration;
+		}
+
+	}
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonsServiceTrackerCustomizer.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonsServiceTrackerCustomizer.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonsServiceTrackerCustomizer.java
deleted file mode 100644
index 4fc29b5..0000000
--- a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/activator/SingletonsServiceTrackerCustomizer.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
- * <p>
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- * <p>
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- */
-
-package com.liferay.portal.remote.rest.extender.activator;
-
-import com.liferay.portal.remote.rest.extender.internal.CXFJaxRsServiceRegistrator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-import javax.ws.rs.ext.Provider;
-
-/**
- * @author Carlos Sierra Andr�s
- */
-public class SingletonsServiceTrackerCustomizer
-	implements ServiceTrackerCustomizer<CXFJaxRsServiceRegistrator, CXFJaxRsServiceRegistrator> {
-
-	private final BundleContext _bundleContext;
-	private final ClassLoader _classLoader;
-	private final Class<?> _serviceClass;
-	private final Object _service;
-
-	public SingletonsServiceTrackerCustomizer(
-		BundleContext bundleContext, ClassLoader classLoader,
-		Object service) {
-
-		_bundleContext = bundleContext;
-		_classLoader = classLoader;
-		_service = service;
-
-		_serviceClass = service.getClass();
-	}
-
-	@Override
-	public CXFJaxRsServiceRegistrator addingService(
-		ServiceReference<CXFJaxRsServiceRegistrator> reference) {
-
-		Thread thread = Thread.currentThread();
-
-		ClassLoader contextClassLoader =
-			thread.getContextClassLoader();
-
-		CXFJaxRsServiceRegistrator cxfJaxRsServiceRegistrator =
-			_bundleContext.getService(reference);
-
-		try {
-			thread.setContextClassLoader(_classLoader);
-
-			if (_serviceClass.isAnnotationPresent(Provider.class)) {
-				cxfJaxRsServiceRegistrator.addProvider(_service);
-			} else {
-				cxfJaxRsServiceRegistrator.addService(_service);
-			}
-
-			return cxfJaxRsServiceRegistrator;
-		}
-		catch (Exception e) {
-			_bundleContext.ungetService(reference);
-
-			throw e;
-		}
-		finally {
-			thread.setContextClassLoader(contextClassLoader);
-		}
-	}
-
-	@Override
-	public void modifiedService(
-		ServiceReference<CXFJaxRsServiceRegistrator> reference,
-		CXFJaxRsServiceRegistrator registrator) {
-
-		removedService(reference, registrator);
-
-		addingService(reference);
-	}
-
-	@Override
-	public void removedService(
-		ServiceReference<CXFJaxRsServiceRegistrator> reference,
-		CXFJaxRsServiceRegistrator registrator) {
-
-		if (_serviceClass.isAnnotationPresent(Provider.class)) {
-			registrator.removeProvider(_service);
-		} else {
-			registrator.removeService(_service);
-		}
-
-		_bundleContext.ungetService(reference);
-	}
-}

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/internal/CXFJaxRsServiceRegistrator.java
----------------------------------------------------------------------
diff --git a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/internal/CXFJaxRsServiceRegistrator.java b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/internal/CXFJaxRsServiceRegistrator.java
index 31b35fa..1e9635c 100644
--- a/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/internal/CXFJaxRsServiceRegistrator.java
+++ b/portal-remote-rest-extender/src/main/java/com/liferay/portal/remote/rest/extender/internal/CXFJaxRsServiceRegistrator.java
@@ -26,6 +26,7 @@ import javax.ws.rs.ext.RuntimeDelegate;
 import org.apache.cxf.Bus;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
 import org.apache.cxf.jaxrs.provider.json.JSONProvider;
 
 /**
@@ -119,7 +120,14 @@ public class CXFJaxRsServiceRegistrator {
 		}
 
 		for (Object service : _services) {
-			jaxRsServerFactoryBean.setServiceBean(service);
+			jaxRsServerFactoryBean.setResourceProvider(
+				new SingletonResourceProvider(service, true));
+		}
+
+		String address = _properties.get("CXF_ENDPOINT_ADDRESS").toString();
+
+		if (address != null) {
+			jaxRsServerFactoryBean.setAddress(address);
 		}
 
 		Server server = jaxRsServerFactoryBean.create();

http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/87965d09/test-cxf/build.gradle
----------------------------------------------------------------------
diff --git a/test-cxf/build.gradle b/test-cxf/build.gradle
index 0d87a81..0c0d5f4 100644
--- a/test-cxf/build.gradle
+++ b/test-cxf/build.gradle
@@ -48,6 +48,7 @@ dependencies {
     compile group: "org.codehaus.woodstox", name: "stax2-api", transitive: false, version: "3.1.4"
     compile group: "org.codehaus.woodstox", name: "woodstox-core-asl", transitive: false, version: "4.4.1"
 	compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
+	compile group: 'org.ow2.asm', name: 'asm', version: '5.0.4'
 }
 
 task cleanDeps(type: Delete) {