cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r921475 - in /cxf/trunk/rt/frontend/jaxrs/src: main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
Date Wed, 10 Mar 2010 17:44:40 GMT
Author: sergeyb
Date: Wed Mar 10 17:44:39 2010
New Revision: 921475

URL: http://svn.apache.org/viewvc?rev=921475&view=rev
Log:
CXF-2462 : another fix to do with handling quoted header values

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java?rev=921475&r1=921474&r2=921475&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
Wed Mar 10 17:44:39 2010
@@ -215,6 +215,11 @@ public class HttpHeadersImpl implements 
                 return newValues;
             }
         }
+        if (originalValue.startsWith("\"") && originalValue.endsWith("\"")) {
+            String actualValue = originalValue.length() == 2 ? "" 
+                : originalValue.substring(1, originalValue.length() - 1);
+            return Collections.singletonList(actualValue);
+        }
         List<String> values = new ArrayList<String>(4);
         Matcher m = COMPLEX_HEADER_PATTERN.matcher(originalValue);
         while (m.find()) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java?rev=921475&r1=921474&r2=921475&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
Wed Mar 10 17:44:39 2010
@@ -112,6 +112,23 @@ public class HttpHeadersImplTest extends
         assertEquals("Nonce=\"bar\"", values.get(2));
     }
     
+    @Test
+    public void testGetHeaderWithQuotes3() throws Exception {
+        
+        Message m = control.createMock(Message.class);
+        m.get(Message.PROTOCOL_HEADERS);
+        MetadataMap<String, String> headers = 
+            createHeader("COMPLEX_HEADER", "\"value with space\"");
+        EasyMock.expectLastCall().andReturn(headers);
+        control.replay();
+        HttpHeaders h = new HttpHeadersImpl(m);
+        List<String> values = h.getRequestHeader("COMPLEX_HEADER");
+        assertNotNull(values);
+        assertEquals(1, values.size());
+        assertEquals("value with space", values.get(0));
+        
+    }
+    
     
     @Test
     public void testGetHeaders() throws Exception {



Mime
View raw message