cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1239371 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java
Date Wed, 01 Feb 2012 22:27:24 GMT
Author: sergeyb
Date: Wed Feb  1 22:27:24 2012
New Revision: 1239371

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

................
  r1239368 | sergeyb | 2012-02-01 22:24:19 +0000 (Wed, 01 Feb 2012) | 9 lines
  
  Merged revisions 1239365 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1239365 | sergeyb | 2012-02-01 22:20:29 +0000 (Wed, 01 Feb 2012) | 1 line
    
    Better support for wildcard media types
  ........
................

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  1 22:27:24 2012
@@ -1,2 +1,2 @@
-/cxf/branches/2.5.x-fixes:1236643,1236851
-/cxf/trunk:1236624,1236849
+/cxf/branches/2.5.x-fixes:1236643,1236851,1239368
+/cxf/trunk:1236624,1236849,1239365

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

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java?rev=1239371&r1=1239370&r2=1239371&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
Wed Feb  1 22:27:24 2012
@@ -41,12 +41,15 @@ public class MediaTypeHeaderProvider imp
             throw new IllegalArgumentException("Media type value can not be null");
         }
         
-        if (mType.equals(MediaType.MEDIA_TYPE_WILDCARD) || mType.startsWith("*;")) {
-            return new MediaType("*", "*");
-        }
-        
         int i = mType.indexOf('/');
         if (i == -1) {
+            mType = mType.trim();
+            if (mType.startsWith(MediaType.MEDIA_TYPE_WILDCARD)) {
+                char next = mType.length() == 1 ? ' ' : mType.charAt(1);
+                if (next == ' ' || next == ';') {
+                    return new MediaType("*", "*");
+                }
+            }
             throw new IllegalArgumentException("Media type separator is missing");
         }
         

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java?rev=1239371&r1=1239370&r2=1239371&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProviderTest.java
Wed Feb  1 22:27:24 2012
@@ -58,6 +58,13 @@ public class MediaTypeHeaderProviderTest
     }
     
     @Test
+    public void testShortWildcardWithParameters2() {
+        MediaType m = MediaType.valueOf("* ;q=0.2");
+        assertEquals("Media type was not parsed correctly", 
+                     m, new MediaType("*", "*"));
+    }
+    
+    @Test
     public void testBadType() {
         try {
             new MediaTypeHeaderProvider().fromString("texthtml");



Mime
View raw message