cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1038731 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
Date Wed, 24 Nov 2010 17:57:48 GMT
Author: sergeyb
Date: Wed Nov 24 17:57:47 2010
New Revision: 1038731

URL: http://svn.apache.org/viewvc?rev=1038731&view=rev
Log:
Merged revisions 1038727 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.3.x-fixes

................
  r1038727 | sergeyb | 2010-11-24 17:52:33 +0000 (Wed, 24 Nov 2010) | 9 lines
  
  Merged revisions 1038722 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1038722 | sergeyb | 2010-11-24 17:48:27 +0000 (Wed, 24 Nov 2010) | 1 line
    
    [CXF-3147] Defaulting to UTF-8 if form media type is null
  ........
................

Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java

Propchange: cxf/branches/2.2.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 24 17:57:47 2010
@@ -1,2 +1,2 @@
-/cxf/branches/2.3.x-fixes:1038378,1038416
-/cxf/trunk:1038374,1038386
+/cxf/branches/2.3.x-fixes:1038378,1038416,1038727
+/cxf/trunk:1038374,1038386,1038722

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java?rev=1038731&r1=1038730&r2=1038731&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
Wed Nov 24 17:57:47 2010
@@ -71,7 +71,7 @@ public final class FormUtils {
     }
     
     private static String getCharset(MediaType mt) {
-        String charset = mt.getParameters().get("charset");
+        String charset = mt == null ? "UTF-8" : mt.getParameters().get("charset");
         return charset == null ? "UTF-8" : charset;
     }
     

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java?rev=1038731&r1=1038730&r2=1038731&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
(original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
Wed Nov 24 17:57:47 2010
@@ -989,16 +989,27 @@ public class JAXRSUtilsTest extends Asse
         assertEquals("bar foo", params.get(1));
     }
     
-    @SuppressWarnings("unchecked")
     @Test
     public void testFormParameters() throws Exception {
+        doTestFormParameters(true);
+    }
+    
+    @Test
+    public void testFormParametersWithoutMediaType() throws Exception {
+        doTestFormParameters(false);
+    }
+    
+    @SuppressWarnings("unchecked")
+    private void doTestFormParameters(boolean useMediaType) throws Exception {
         Class[] argType = {String.class, List.class};
         Method m = Customer.class.getMethod("testFormParam", argType);
         MessageImpl messageImpl = new MessageImpl();
         String body = "p1=1&p2=2&p2=3";
         messageImpl.put(Message.REQUEST_URI, "/foo");
         MultivaluedMap<String, String> headers = new MetadataMap<String, String>();
-        headers.putSingle("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
+        if (useMediaType) {
+            headers.putSingle("Content-Type", MediaType.APPLICATION_FORM_URLENCODED);
+        }
         messageImpl.put(Message.PROTOCOL_HEADERS, headers);
         messageImpl.setContent(InputStream.class, new ByteArrayInputStream(body.getBytes()));
         List<Object> params = JAXRSUtils.processParameters(new OperationResourceInfo(m,
null), 



Mime
View raw message