cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1539481 - in /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider: ProviderFactory.java XSLTJaxbProvider.java
Date Wed, 06 Nov 2013 22:17:59 GMT
Author: sergeyb
Date: Wed Nov  6 22:17:58 2013
New Revision: 1539481

URL: http://svn.apache.org/r1539481
Log:
Minor update to XSLTJaxbProvider

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=1539481&r1=1539480&r2=1539481&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
Wed Nov  6 22:17:58 2013
@@ -1226,7 +1226,9 @@ public abstract class ProviderFactory {
     
     public MessageBodyWriter<?> getRegisteredJaxbWriter() {
         for (ProviderInfo<MessageBodyWriter<?>> pi : this.messageWriters) { 
  
-            if (pi.getProvider().getClass().getName().equals(JAXB_PROVIDER_NAME)) {
+            Class<?> cls = pi.getProvider().getClass();
+            if (cls.getName().equals(JAXB_PROVIDER_NAME)
+                || cls.getSuperclass().getName().equals(JAXB_PROVIDER_NAME)) {
                 return pi.getProvider();
             }
         }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java?rev=1539481&r1=1539480&r2=1539481&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
Wed Nov  6 22:17:58 2013
@@ -104,16 +104,17 @@ public class XSLTJaxbProvider<T> extends
     
     @Override
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, MediaType
mt) {
-        if (InjectionUtils.isSupportedCollectionOrArray(type)) {
-            return false;
-        }
-        // JAXB support is required
         if (!super.isReadable(type, genericType, anns, mt)) {
             return false;
         }
+        
+        if (InjectionUtils.isSupportedCollectionOrArray(type)) {
+            return supportJaxbOnly;
+        }
+        
         // if the user has set the list of in classes and a given class 
         // is in that list then it can only be handled by the template
-        if (inClassCanBeHandled(type.getName())) {
+        if (inClassCanBeHandled(type.getName()) || inClassesToHandle == null && !supportJaxbOnly)
{
             return inTemplatesAvailable(mt); 
         } else {
             return supportJaxbOnly;
@@ -122,16 +123,17 @@ public class XSLTJaxbProvider<T> extends
     
     @Override
     public boolean isWriteable(Class<?> type, Type genericType, Annotation[] anns,
MediaType mt) {
-        if (InjectionUtils.isSupportedCollectionOrArray(type)) {
-            return false;
-        }
         // JAXB support is required
-        if (!super.isReadable(type, genericType, anns, mt)) {
+        if (!super.isWriteable(type, genericType, anns, mt)) {
             return false;
         }
+        if (InjectionUtils.isSupportedCollectionOrArray(type)) {
+            return supportJaxbOnly;
+        }
+        
         // if the user has set the list of out classes and a given class 
         // is in that list then it can only be handled by the template
-        if (outClassCanBeHandled(type.getName())) {
+        if (outClassCanBeHandled(type.getName()) || outClassesToHandle == null &&
!supportJaxbOnly) {
             return outTemplatesAvailable(mt); 
         } else {
             return supportJaxbOnly;
@@ -191,7 +193,7 @@ public class XSLTJaxbProvider<T> extends
     private void trySettingProperties(Object filter, TemplatesImpl ti) {
         try {
             //Saxon doesn't allow creating a Filter or Handler from anything other than it's
original 
-            //Templates.  That then requires setting the paramaters after the fact, but there
+            //Templates.  That then requires setting the parameters after the fact, but there
             //isn't a standard API for that, so we have to grab the Transformer via reflection
to
             //set the parameters.
             Transformer tr = (Transformer)filter.getClass().getMethod("getTransformer").invoke(filter);
@@ -322,7 +324,7 @@ public class XSLTJaxbProvider<T> extends
     }
     
     public boolean inClassCanBeHandled(String className) {
-        return inClassesToHandle == null || inClassesToHandle.contains(className); 
+        return inClassesToHandle != null && inClassesToHandle.contains(className);

     }
     
     public void setOutClassNames(List<String> classNames) {
@@ -330,7 +332,7 @@ public class XSLTJaxbProvider<T> extends
     }
     
     public boolean outClassCanBeHandled(String className) {
-        return outClassesToHandle == null || outClassesToHandle.contains(className); 
+        return outClassesToHandle != null && outClassesToHandle.contains(className);

     }
     
     protected Templates createTemplates(Templates templates, 



Mime
View raw message