cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1497711 - in /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs: provider/AbstractJAXBProvider.java provider/JAXBElementProvider.java utils/JAXRSUtils.java
Date Fri, 28 Jun 2013 10:12:49 GMT
Author: sergeyb
Date: Fri Jun 28 10:12:49 2013
New Revision: 1497711

URL: http://svn.apache.org/r1497711
Log:
Reverting 1497709

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1497711&r1=1497710&r2=1497711&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
Fri Jun 28 10:12:49 2013
@@ -91,8 +91,8 @@ public abstract class AbstractJAXBProvid
     protected static final ResourceBundle BUNDLE = BundleUtils.getBundle(AbstractJAXBProvider.class);
 
     protected static final Logger LOG = LogUtils.getL7dLogger(AbstractJAXBProvider.class);
-    protected static final String NS_MAPPER_PROPERTY_RI = "com.sun.xml.bind.namespacePrefixMapper";
-    protected static final String NS_MAPPER_PROPERTY_RI_INT = "com.sun.xml.internal.bind.namespacePrefixMapper";
+    protected static final String NS_MAPPER_PROPERTY = "com.sun.xml.bind.namespacePrefixMapper";
+    protected static final String NS_MAPPER_PROPERTY_INT = "com.sun.xml.internal.bind.namespacePrefixMapper";
     private static final String JAXB_DEFAULT_NAMESPACE = "##default";
     private static final String JAXB_DEFAULT_NAME = "##default";
     
@@ -137,16 +137,10 @@ public abstract class AbstractJAXBProvid
     private Unmarshaller.Listener unmarshallerListener;
     private Marshaller.Listener marshallerListener;
     private DocumentDepthProperties depthProperties;
-    private String namespaceMapperPropertyName;
     
-    protected void setNamespaceMapper(Marshaller ms, 
-                                      Map<String, String> map) throws Exception {
+    protected static void setNamespaceMapper(Marshaller ms, Map<String, String> map)
throws Exception {
         NamespaceMapper nsMapper = new NamespaceMapper(map);
-        if (namespaceMapperPropertyName != null) {
-            setMarshallerProp(ms, nsMapper, namespaceMapperPropertyName, null);
-        } else {
-            setMarshallerProp(ms, nsMapper, NS_MAPPER_PROPERTY_RI, NS_MAPPER_PROPERTY_RI_INT);
-        }
+        setMarshallerProp(ms, nsMapper, NS_MAPPER_PROPERTY, NS_MAPPER_PROPERTY_INT);
     }
     
     protected static void setMarshallerProp(Marshaller ms, Object value, 
@@ -154,11 +148,7 @@ public abstract class AbstractJAXBProvid
         try {
             ms.setProperty(name1, value);
         } catch (PropertyException ex) {
-            if (name2 != null) {
-                ms.setProperty(name2, value);
-            } else {
-                throw ex;
-            }
+            ms.setProperty(name2, value);
         }
         
     }
@@ -810,10 +800,6 @@ public abstract class AbstractJAXBProvid
         this.marshallerListener = marshallerListener;
     }
 
-    public void setNamespaceMapperPropertyName(String namespaceMapperProperty) {
-        this.namespaceMapperPropertyName = namespaceMapperProperty;
-    }
-
     @XmlRootElement
     protected static class CollectionWrapper {
         

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=1497711&r1=1497710&r2=1497711&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
Fri Jun 28 10:12:49 2013
@@ -79,8 +79,8 @@ import org.apache.cxf.staxutils.transfor
 @Provider
 public class JAXBElementProvider<T> extends AbstractJAXBProvider<T>  {
     private static final String XML_PI_START = "<?xml version=\"1.0\" encoding=\"";
-    private static final String XML_PI_PROPERTY_RI = "com.sun.xml.bind.xmlHeaders";
-    private static final String XML_PI_PROPERTY_RI_INT = "com.sun.xml.internal.bind.xmlHeaders";
+    private static final String XML_PI_PROPERTY = "com.sun.xml.bind.xmlHeaders";
+    private static final String XML_PI_PROPERTY_INT = "com.sun.xml.internal.bind.xmlHeaders";
     
     private static final List<String> MARSHALLER_PROPERTIES =
         Arrays.asList(new String[] {Marshaller.JAXB_ENCODING,
@@ -88,15 +88,14 @@ public class JAXBElementProvider<T> exte
                                     Marshaller.JAXB_FRAGMENT,
                                     Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION,
                                     Marshaller.JAXB_SCHEMA_LOCATION,
-                                    NS_MAPPER_PROPERTY_RI,
-                                    NS_MAPPER_PROPERTY_RI_INT,
-                                    XML_PI_PROPERTY_RI,
-                                    XML_PI_PROPERTY_RI_INT});
+                                    NS_MAPPER_PROPERTY,
+                                    NS_MAPPER_PROPERTY_INT,
+                                    XML_PI_PROPERTY,
+                                    XML_PI_PROPERTY_INT});
     
     private Map<String, Object> mProperties = Collections.emptyMap();
     private Map<String, String> nsPrefixes = Collections.emptyMap();
     private String xmlResourceOffset = "";
-    private String xmlPiPropertyName;
     
     public JAXBElementProvider() {
         
@@ -110,14 +109,6 @@ public class JAXBElementProvider<T> exte
         nsPrefixes = prefixes;
     }
     
-    protected void setXmlPiProperty(Marshaller ms, String value) throws Exception {
-        if (xmlPiPropertyName != null) {
-            setMarshallerProp(ms, value, xmlPiPropertyName, null);
-        } else {
-            setMarshallerProp(ms, value, XML_PI_PROPERTY_RI, XML_PI_PROPERTY_RI_INT);
-        }
-    }
-    
     @Override
     protected boolean canBeReadAsJaxbElement(Class<?> type) {
         return super.canBeReadAsJaxbElement(type) 
@@ -436,7 +427,7 @@ public class JAXBElementProvider<T> exte
                 String absRef = buildAbsoluteXMLResourceURI(relRef);
                 value = value.substring(0, ind + 6) + absRef + "'?>";
             }
-            setXmlPiProperty(ms, value);
+            setMarshallerProp(ms, value, XML_PI_PROPERTY, XML_PI_PROPERTY_INT);
         }
     }
     
@@ -581,9 +572,5 @@ public class JAXBElementProvider<T> exte
         throws Exception {
         ms.marshal(obj, writer);
     }
-
-    public void setXmlPiPropertyName(String xmlPiPropertyName) {
-        this.xmlPiPropertyName = xmlPiPropertyName;
-    }
     
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=1497711&r1=1497710&r2=1497711&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Fri
Jun 28 10:12:49 2013
@@ -163,12 +163,11 @@ public final class JAXRSUtils {
     public static final String ROOT_PROVIDER = "service.root.provider";
     public static final String EXCEPTION_FROM_MAPPER = "exception.from.mapper";
     public static final String PARTIAL_HIERARCHICAL_MEDIA_SUBTYPE_CHECK = 
-        "media.subtype.partial.check";
+        "media.subtype.partial.check"; 
     public static final String DOC_LOCATION = "wadl.location";
     public static final String MEDIA_TYPE_Q_PARAM = "q";
     public static final String MEDIA_TYPE_QS_PARAM = "qs";
     private static final String MEDIA_TYPE_DISTANCE_PARAM = "d";
-    private static final String DEFAULT_CONTENT_TYPE = "default.content.type";
     
     private static final Logger LOG = LogUtils.getL7dLogger(JAXRSUtils.class);
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JAXRSUtils.class);
@@ -828,8 +827,7 @@ public final class JAXRSUtils {
             String contentType = (String)message.get(Message.CONTENT_TYPE);
 
             if (contentType == null) {
-                String defaultCt = (String)message.getContextualProperty(DEFAULT_CONTENT_TYPE);
-                contentType = defaultCt == null ? MediaType.APPLICATION_OCTET_STREAM : defaultCt;
+                contentType = MediaType.APPLICATION_OCTET_STREAM;
             }
 
             return readFromMessageBody(parameterClass,
@@ -1306,15 +1304,17 @@ public final class JAXRSUtils {
                 } catch (Exception ex) {
                     throw new Fault(ex);
                 }
-            }
-        }
-
-        String errorMessage = new org.apache.cxf.common.i18n.Message("NO_MSG_READER",
+            } else {
+                String errorMessage = new org.apache.cxf.common.i18n.Message("NO_MSG_READER",
                                                        BUNDLE,
                                                        targetTypeClass.getSimpleName(),
                                                        mediaTypeToString(contentType)).toString();
-        LOG.warning(errorMessage);
-        throw new WebApplicationException(Response.Status.UNSUPPORTED_MEDIA_TYPE);
+                LOG.warning(errorMessage);
+                throw new WebApplicationException(Response.Status.UNSUPPORTED_MEDIA_TYPE);
+            }
+        }
+
+        return null;
     }
     
     @SuppressWarnings("unchecked")



Mime
View raw message