You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2022/02/10 14:09:47 UTC

[cxf] branch 3.5.x-fixes updated: CXF-8654: Ensure InputStreamDataSource is optional in JAXRSUtils to be able to run without activation dependency (#905)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.5.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.5.x-fixes by this push:
     new 9e3f025  CXF-8654: Ensure InputStreamDataSource is optional in JAXRSUtils to be able to run without activation dependency (#905)
9e3f025 is described below

commit 9e3f02570af9868a4b3fb094f01aed0d8c8d9d92
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Thu Feb 10 07:29:30 2022 -0500

    CXF-8654: Ensure InputStreamDataSource is optional in JAXRSUtils to be able to run without activation dependency (#905)
    
    (cherry picked from commit c4716aeb0c598075910250d8173b2b6fe3691eff)
---
 .../java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
index 73e73a8..9057595 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
@@ -104,10 +104,7 @@ import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.jaxrs.ext.MessageContextImpl;
 import org.apache.cxf.jaxrs.ext.ProtocolHeaders;
 import org.apache.cxf.jaxrs.ext.ProtocolHeadersImpl;
-import org.apache.cxf.jaxrs.ext.multipart.Attachment;
-import org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource;
 import org.apache.cxf.jaxrs.ext.multipart.MultipartBody;
-import org.apache.cxf.jaxrs.ext.xml.XMLSource;
 import org.apache.cxf.jaxrs.impl.AsyncResponseImpl;
 import org.apache.cxf.jaxrs.impl.ContainerRequestContextImpl;
 import org.apache.cxf.jaxrs.impl.ContainerResponseContextImpl;
@@ -175,9 +172,13 @@ public final class JAXRSUtils {
     private static final Annotation[] EMPTY_ANNOTATIONS = new Annotation[0];
     private static final Set<Class<?>> STREAMING_OUT_TYPES = new HashSet<>(
         Arrays.asList(InputStream.class, Reader.class, StreamingOutput.class));
-    private static final Set<Class<?>> STREAMING_LIKE_OUT_TYPES = new HashSet<>(
-        Arrays.asList(XMLSource.class, InputStreamDataSource.class, 
-            MultipartBody.class, Attachment.class));
+    private static final Set<String> STREAMING_LIKE_OUT_TYPES = new HashSet<>(
+        Arrays.asList(
+            "org.apache.cxf.jaxrs.ext.xml.XMLSource", 
+            "org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource", 
+            "org.apache.cxf.jaxrs.ext.multipart.MultipartBody", 
+            "org.apache.cxf.jaxrs.ext.multipart.Attachment"
+        ));
     private static final Set<String> REACTIVE_OUT_TYPES = new HashSet<>(
         Arrays.asList(
             // Reactive Streams
@@ -215,7 +216,7 @@ public final class JAXRSUtils {
      */
     public static boolean isStreamingLikeOutType(Class<?> cls, Type type) {
         if (cls != null && (isStreamingOutType(cls) 
-                || STREAMING_LIKE_OUT_TYPES.contains(cls) 
+                || STREAMING_LIKE_OUT_TYPES.contains(cls.getName()) 
                 || REACTIVE_OUT_TYPES.contains(cls.getName()))) {
             return true;
         }
@@ -231,7 +232,7 @@ public final class JAXRSUtils {
         
         if (type instanceof Class) {
             final Class<?> typeCls = (Class<?>)type;
-            return isStreamingOutType(typeCls) || STREAMING_LIKE_OUT_TYPES.contains(typeCls);
+            return isStreamingOutType(typeCls) || STREAMING_LIKE_OUT_TYPES.contains(typeCls.getName());
         }
         
         return false;