cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1086617 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ rt/ws/security/
Date Tue, 29 Mar 2011 15:04:54 GMT
Author: sergeyb
Date: Tue Mar 29 15:04:53 2011
New Revision: 1086617

URL: http://svn.apache.org/viewvc?rev=1086617&view=rev
Log:
Merged revisions 1086615 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1086615 | sergeyb | 2011-03-29 16:01:20 +0100 (Tue, 29 Mar 2011) | 1 line
  
  [JAX-RS] Making sure JAXBProvider does not accept XMLSource if unmarshalAsJaxbElement flag
is set
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
    cxf/branches/2.3.x-fixes/rt/ws/security/   (props changed)

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 29 15:04:53 2011
@@ -1 +1 @@
-/cxf/trunk:1084966,1086102,1086115,1086535,1086573,1086588
+/cxf/trunk:1084966,1086102,1086115,1086535,1086573,1086588,1086615

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

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1086617&r1=1086616&r2=1086617&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
Tue Mar 29 15:04:53 2011
@@ -237,7 +237,7 @@ public abstract class AbstractJAXBProvid
             }
         }
         
-        return unmarshalAsJaxbElement || isSupported(type, genericType, anns);
+        return marshalAsJaxbElement || isSupported(type, genericType, anns);
     }
     
     protected JAXBContext getCollectionContext(Class<?> type) throws JAXBException
{
@@ -337,9 +337,13 @@ public abstract class AbstractJAXBProvid
     }
     
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] anns, MediaType
mt) {
-        return (marshalAsJaxbElement && type != Response.class) || isSupported(type,
genericType, anns);
+        return canBeReadAsJaxbElement(type) || isSupported(type, genericType, anns);
     }
 
+    protected boolean canBeReadAsJaxbElement(Class<?> type) {
+        return unmarshalAsJaxbElement && type != Response.class;
+    }
+    
     public void setSchemaLocations(List<String> locations) {
         schema = SchemaHandler.createSchema(locations, getBus());    
     }

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=1086617&r1=1086616&r2=1086617&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
Tue Mar 29 15:04:53 2011
@@ -56,6 +56,7 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxb.NamespaceMapper;
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.ext.xml.XMLSource;
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.schemas.SchemaHandler;
@@ -96,6 +97,11 @@ public class JAXBElementProvider extends
         return super.isReadable(type, genericType, anns, mt);
     }
     
+    @Override
+    protected boolean canBeReadAsJaxbElement(Class<?> type) {
+        return type != XMLSource.class && super.canBeReadAsJaxbElement(type);
+    }
+    
     @Context
     public void setMessageContext(MessageContext mc) {
         super.setContext(mc);

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java?rev=1086617&r1=1086616&r2=1086617&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
Tue Mar 29 15:04:53 2011
@@ -64,6 +64,7 @@ import org.w3c.dom.Node;
 
 import org.xml.sax.ContentHandler;
 
+import org.apache.cxf.jaxrs.ext.xml.XMLSource;
 import org.apache.cxf.jaxrs.fortest.jaxb.packageinfo.Book2NoRootElement;
 import org.apache.cxf.jaxrs.impl.MetadataMap;
 import org.apache.cxf.jaxrs.model.ClassResourceInfo;
@@ -1024,6 +1025,14 @@ public class JAXBElementProviderTest ext
                                  new Annotation[]{}, MediaType.APPLICATION_XML_TYPE));
     }
     
+    
+    @Test 
+    public void testXMLSourceIsNotReadable() {
+        JAXBElementProvider p = new JAXBElementProvider();
+        assertFalse(p.isReadable(XMLSource.class, 
+                                 XMLSource.class, 
+                                 new Annotation[]{}, MediaType.APPLICATION_XML_TYPE));
+    }
     @Test 
     public void testPackageContextObjectFactory() {
         JAXBElementProvider p = new JAXBElementProvider();

Propchange: cxf/branches/2.3.x-fixes/rt/ws/security/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 29 15:04:53 2011
@@ -1 +1 @@
-/cxf/trunk/rt/ws/security:1084966,1086102,1086115,1086535,1086550,1086573
+/cxf/trunk/rt/ws/security:1084966,1086102,1086115,1086535,1086550,1086573,1086615



Mime
View raw message