cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1539483 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
Date Wed, 06 Nov 2013 22:21:44 GMT
Author: sergeyb
Date: Wed Nov  6 22:21:44 2013
New Revision: 1539483

URL: http://svn.apache.org/r1539483
Log:
Merged revisions 1539481 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1539481 | sergeyb | 2013-11-06 22:17:58 +0000 (Wed, 06 Nov 2013) | 1 line
  
  Minor update to XSLTJaxbProvider
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1539481

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=1539483&r1=1539482&r2=1539483&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
Wed Nov  6 22:21:44 2013
@@ -1681,7 +1681,9 @@ public final 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/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java?rev=1539483&r1=1539482&r2=1539483&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
Wed Nov  6 22:21:44 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