cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1104144 - in /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider: AegisJSONProvider.java DataBindingJSONProvider.java JSONProvider.java JSONUtils.java
Date Tue, 17 May 2011 11:13:30 GMT
Author: sergeyb
Date: Tue May 17 11:13:30 2011
New Revision: 1104144

URL: http://svn.apache.org/viewvc?rev=1104144&view=rev
Log:
[CXF-3483] JSONProvider can not convert attributes to elements when explicit collections are
used

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java?rev=1104144&r1=1104143&r2=1104144&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AegisJSONProvider.java
Tue May 17 11:13:30 2011
@@ -127,7 +127,8 @@ public final class AegisJSONProvider<T> 
     protected XMLStreamWriter createStreamWriter(QName typeQName, OutputStream os) throws
Exception {
         
         Configuration config = 
-            JSONUtils.createConfiguration(namespaceMap, writeXsiType && !ignoreNamespaces,
null);
+            JSONUtils.createConfiguration(namespaceMap, 
+                                          writeXsiType && !ignoreNamespaces, false,
null);
         XMLStreamWriter writer = JSONUtils.createStreamWriter(os, typeQName, 
              writeXsiType && !ignoreNamespaces, config, serializeAsArray, arrayKeys,
dropRootElement);
         return JSONUtils.createIgnoreNsWriterIfNeeded(writer, ignoreNamespaces);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java?rev=1104144&r1=1104143&r2=1104144&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProvider.java
Tue May 17 11:13:30 2011
@@ -95,7 +95,8 @@ public class DataBindingJSONProvider<T> 
             qname = getQName(InjectionUtils.getActualType(genericType));
         }
         Configuration config = 
-            JSONUtils.createConfiguration(namespaceMap, writeXsiType && !ignoreNamespaces,
null);
+            JSONUtils.createConfiguration(namespaceMap, writeXsiType && !ignoreNamespaces,
+                                          false, null);
         XMLStreamWriter writer = JSONUtils.createStreamWriter(os, qname, 
              writeXsiType && !ignoreNamespaces, config, serializeAsArray, arrayKeys,
dropRootElement);
         writer = JSONUtils.createIgnoreMixedContentWriterIfNeeded(writer, ignoreMixedContent);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java?rev=1104144&r1=1104143&r2=1104144&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
Tue May 17 11:13:30 2011
@@ -85,6 +85,12 @@ public class JSONProvider extends Abstra
     private boolean ignoreNamespaces;
     private String convention = MAPPED_CONVENTION;
     private TypeConverter typeConverter;
+    private boolean attributesToElements;
+    
+    @Override
+    public void setAttributesToElements(boolean value) {
+        this.attributesToElements = value;
+    }
     
     public void setConvention(String value) {
         if (!MAPPED_CONVENTION.equals(value) && !BADGER_FISH_CONVENTION.equals(value))
{
@@ -398,7 +404,10 @@ public class JSONProvider extends Abstra
         QName qname = getQName(actualClass, genericType, actualObject, true);
         
         Configuration config = 
-            JSONUtils.createConfiguration(namespaceMap, writeXsiType && !ignoreNamespaces,
typeConverter);
+            JSONUtils.createConfiguration(namespaceMap, 
+                                          writeXsiType && !ignoreNamespaces,
+                                          attributesToElements,
+                                          typeConverter);
         
         XMLStreamWriter writer = JSONUtils.createStreamWriter(os, qname, 
              writeXsiType && !ignoreNamespaces, config, serializeAsArray, arrayKeys,

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java?rev=1104144&r1=1104143&r2=1104144&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
Tue May 17 11:13:30 2011
@@ -101,11 +101,13 @@ public final class JSONUtils {
     
     public static Configuration createConfiguration(ConcurrentHashMap<String, String>
namespaceMap,
                                                     boolean writeXsiType,
+                                                    boolean attributesAsElements,
                                                     TypeConverter converter) {
         if (writeXsiType) {
             namespaceMap.putIfAbsent(XSI_URI, XSI_PREFIX);
         }
         Configuration c = new Configuration(namespaceMap);
+        c.setSupressAtAttributes(attributesAsElements);
         if (converter != null) {
             c.setTypeConverter(converter);
         }



Mime
View raw message