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 2018/03/20 14:34:38 UTC
[1/3] aries-jax-rs-whiteboard git commit: No need to use TCCL
Repository: aries-jax-rs-whiteboard
Updated Branches:
refs/heads/master b60684356 -> 6e533f0df
No need to use TCCL
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/770cd697
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/770cd697
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/770cd697
Branch: refs/heads/master
Commit: 770cd69796551802105c82764bcc0142d4db316b
Parents: b606843
Author: Carlos Sierra <cs...@apache.org>
Authored: Tue Mar 20 11:03:48 2018 +0100
Committer: Carlos Sierra <cs...@apache.org>
Committed: Tue Mar 20 11:03:48 2018 +0100
----------------------------------------------------------------------
.../activator/CxfJaxrsBundleActivator.java | 31 ++------------------
1 file changed, 3 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/770cd697/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CxfJaxrsBundleActivator.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CxfJaxrsBundleActivator.java b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CxfJaxrsBundleActivator.java
index 26024f5..f99cee7 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CxfJaxrsBundleActivator.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/activator/CxfJaxrsBundleActivator.java
@@ -33,6 +33,7 @@ import org.apache.aries.jax.rs.whiteboard.internal.utils.PropertyHolder;
import org.apache.aries.osgi.functional.OSGi;
import org.apache.aries.osgi.functional.OSGiResult;
import org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl;
+import org.apache.cxf.jaxrs.sse.client.SseEventSourceBuilderImpl;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -167,42 +168,16 @@ public class CxfJaxrsBundleActivator implements BundleActivator {
}
private static OSGi<?> registerSseEventSourceFactory() {
- ClassLoader classLoader = CxfJaxrsBundleActivator.class.getClassLoader();
-
return register(
SseEventSourceFactory.class, new SseEventSourceFactory() {
@Override
public SseEventSource.Builder newBuilder(WebTarget target) {
- Thread thread = Thread.currentThread();
-
- ClassLoader contextClassLoader =
- thread.getContextClassLoader();
-
- thread.setContextClassLoader(classLoader);
-
- try {
- return SseEventSource.target(target);
- }
- finally {
- thread.setContextClassLoader(contextClassLoader);
- }
+ return new SseEventSourceBuilderImpl(){{target(target);}};
}
@Override
public SseEventSource newSource(WebTarget target) {
- Thread thread = Thread.currentThread();
-
- ClassLoader contextClassLoader =
- thread.getContextClassLoader();
-
- thread.setContextClassLoader(classLoader);
-
- try {
- return SseEventSource.target(target).build();
- }
- finally {
- thread.setContextClassLoader(contextClassLoader);
- }
+ return newBuilder(target).build();
}
},
new Hashtable<>());
[2/3] aries-jax-rs-whiteboard git commit: Use propietary code
Posted by cs...@apache.org.
Use propietary code
to signal that an application is waiting for a specific ServletContextHelper
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/821b6c0d
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/821b6c0d
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/821b6c0d
Branch: refs/heads/master
Commit: 821b6c0d037a9384f7ba6cc4a88005a6c4c6374c
Parents: 770cd69
Author: Carlos Sierra <cs...@apache.org>
Authored: Tue Mar 20 15:29:28 2018 +0100
Committer: Carlos Sierra <cs...@apache.org>
Committed: Tue Mar 20 15:29:28 2018 +0100
----------------------------------------------------------------------
jax-rs.itests/src/main/java/test/JaxrsTest.java | 6 ++--
.../AriesJaxrsWhiteboardConstants.java | 4 +++
.../internal/AriesJaxrsServiceRuntime.java | 36 ++++++++++++++++----
.../jax/rs/whiteboard/internal/Whiteboard.java | 5 +--
4 files changed, 39 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/821b6c0d/jax-rs.itests/src/main/java/test/JaxrsTest.java
----------------------------------------------------------------------
diff --git a/jax-rs.itests/src/main/java/test/JaxrsTest.java b/jax-rs.itests/src/main/java/test/JaxrsTest.java
index 9751751..99ef934 100644
--- a/jax-rs.itests/src/main/java/test/JaxrsTest.java
+++ b/jax-rs.itests/src/main/java/test/JaxrsTest.java
@@ -917,8 +917,7 @@ public class JaxrsTest extends TestHelper {
applicationRegistration.getReference().getProperty("service.id"),
failedApplicationDTOs[0].serviceId);
assertEquals(
- DTOConstants.FAILURE_REASON_REQUIRED_EXTENSIONS_UNAVAILABLE,
- failedApplicationDTOs[0].failureReason);
+ 101, failedApplicationDTOs[0].failureReason);
ServiceRegistration<ServletContextHelper> context =
bundleContext.registerService(
@@ -1049,8 +1048,7 @@ public class JaxrsTest extends TestHelper {
"service.id"),
failedApplicationDTOs[0].serviceId);
assertEquals(
- DTOConstants.FAILURE_REASON_REQUIRED_EXTENSIONS_UNAVAILABLE,
- failedApplicationDTOs[0].failureReason);
+ 101, failedApplicationDTOs[0].failureReason);
webTarget = createDefaultTarget().
path(
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/821b6c0d/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/AriesJaxrsWhiteboardConstants.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/AriesJaxrsWhiteboardConstants.java b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/AriesJaxrsWhiteboardConstants.java
index 94b4ff4..094c597 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/AriesJaxrsWhiteboardConstants.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/AriesJaxrsWhiteboardConstants.java
@@ -30,4 +30,8 @@ public class AriesJaxrsWhiteboardConstants {
*/
public static final String JAX_RS_APPLICATION_SELECT = "org.apache.aries.jaxrs.application.select";
+ /**
+ * This application is waiting for a ServletContextHelper
+ */
+ public static final int FAILURE_REASON_REQUIRED_CONTEXT_UNAVAILABLE = 101;
}
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/821b6c0d/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/AriesJaxrsServiceRuntime.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/AriesJaxrsServiceRuntime.java b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/AriesJaxrsServiceRuntime.java
index 7c58254..ae8bb08 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/AriesJaxrsServiceRuntime.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/AriesJaxrsServiceRuntime.java
@@ -41,6 +41,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.MediaType;
+import org.apache.aries.jax.rs.whiteboard.AriesJaxrsWhiteboardConstants;
import org.apache.aries.jax.rs.whiteboard.internal.cxf.CxfJaxrsServiceRegistrator;
import org.apache.aries.jax.rs.whiteboard.internal.utils.PropertyHolder;
import org.apache.aries.jax.rs.whiteboard.internal.introspection.ClassIntrospector;
@@ -134,6 +135,12 @@ public class AriesJaxrsServiceRuntime implements JaxrsServiceRuntime {
_clashingResources.add(serviceReference);
}
+ public void addContextDependentApplication(
+ CachingServiceReference<Application> serviceReference) {
+
+ _contextDependentApplications.add(serviceReference);
+ }
+
public void addDependentApplication(
CachingServiceReference<Application> applicationReference) {
@@ -242,16 +249,18 @@ public class AriesJaxrsServiceRuntime implements JaxrsServiceRuntime {
runtimeDTO.failedApplicationDTOs =
Stream.concat(
- invalidApplicationsDTOStream(),
+ contextDependentApplicationsDTOStream(),
Stream.concat(
- shadowedApplicationsDTOStream(),
+ invalidApplicationsDTOStream(),
Stream.concat(
- unreferenciableApplicationsDTOStream(),
+ shadowedApplicationsDTOStream(),
Stream.concat(
- clashingApplicationsDTOStream(),
+ unreferenciableApplicationsDTOStream(),
Stream.concat(
- dependentApplicationsDTOStream(),
- erroredApplicationsDTOStream()))))
+ clashingApplicationsDTOStream(),
+ Stream.concat(
+ dependentApplicationsDTOStream(),
+ erroredApplicationsDTOStream())))))
).toArray(
FailedApplicationDTO[]::new
);
@@ -290,6 +299,13 @@ public class AriesJaxrsServiceRuntime implements JaxrsServiceRuntime {
return runtimeDTO;
}
+ private Stream<FailedApplicationDTO> contextDependentApplicationsDTOStream() {
+ return _contextDependentApplications.stream().map(
+ sr -> buildFailedApplicationDTO(
+ AriesJaxrsWhiteboardConstants.FAILURE_REASON_REQUIRED_CONTEXT_UNAVAILABLE, sr)
+ );
+ }
+
public void removeApplicationDependentExtension(
CachingServiceReference<?> cachingServiceReference) {
@@ -342,6 +358,12 @@ public class AriesJaxrsServiceRuntime implements JaxrsServiceRuntime {
_clashingResources.remove(serviceReference);
}
+ public void removeContextDependentApplication(
+ CachingServiceReference<Application> serviceReference) {
+
+ _contextDependentApplications.remove(serviceReference);
+ }
+
public void removeDependentApplication(
CachingServiceReference<Application> applicationReference) {
@@ -457,6 +479,8 @@ public class AriesJaxrsServiceRuntime implements JaxrsServiceRuntime {
new CopyOnWriteArrayList<>();
private Collection<CachingServiceReference<?>> _clashingResources =
new CopyOnWriteArrayList<>();
+ private Set<CachingServiceReference<Application>>
+ _contextDependentApplications = ConcurrentHashMap.newKeySet();
private volatile ApplicationRuntimeInformation _defaultApplicationProperties;
private Set<CachingServiceReference<Application>> _dependentApplications =
ConcurrentHashMap.newKeySet();
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/821b6c0d/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
index be853ab..5abaf33 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Whiteboard.java
@@ -402,8 +402,9 @@ public class Whiteboard {
OSGi<ApplicationReferenceWithContext> applicationsWithContext =
waitForApplicationContext(
- applicationsForWhiteboard, _runtime::addDependentApplication,
- _runtime::removeDependentApplication);
+ applicationsForWhiteboard,
+ _runtime::addContextDependentApplication,
+ _runtime::removeContextDependentApplication);
OSGi<ApplicationReferenceWithContext> highestRankedPerPath =
highestPer(
[3/3] aries-jax-rs-whiteboard git commit: Update comment to make
warning more concrete
Posted by cs...@apache.org.
Update comment to make warning more concrete
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/6e533f0d
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/6e533f0d
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/6e533f0d
Branch: refs/heads/master
Commit: 6e533f0dfbcfba7681c3498e285e8a69a1648ee2
Parents: 821b6c0
Author: Carlos Sierra <cs...@apache.org>
Authored: Tue Mar 20 15:30:05 2018 +0100
Committer: Carlos Sierra <cs...@apache.org>
Committed: Tue Mar 20 15:30:05 2018 +0100
----------------------------------------------------------------------
jax-rs.itests/src/main/java/test/JaxrsTest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/6e533f0d/jax-rs.itests/src/main/java/test/JaxrsTest.java
----------------------------------------------------------------------
diff --git a/jax-rs.itests/src/main/java/test/JaxrsTest.java b/jax-rs.itests/src/main/java/test/JaxrsTest.java
index 99ef934..eaf9889 100644
--- a/jax-rs.itests/src/main/java/test/JaxrsTest.java
+++ b/jax-rs.itests/src/main/java/test/JaxrsTest.java
@@ -891,7 +891,8 @@ public class JaxrsTest extends TestHelper {
@Test
/**
* Propietary extension... not in the spec
- * breaks application isolation
+ * breaks application isolation if several applications are forced to
+ * use the same ServletContext
*/
public void testApplicationWithProvidedServletContext() {
ServiceRegistration<Application> applicationRegistration =
@@ -954,7 +955,8 @@ public class JaxrsTest extends TestHelper {
@Test
/**
* Propietary extension... not in the spec
- * breaks application isolation
+ * breaks application isolation if several applications are forced to
+ * use the same ServletContext
*/
public void testApplicationWithProvidedServletContextClashes() {
ServiceRegistration<Application> applicationRegistration =