cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1461179 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
Date Tue, 26 Mar 2013 15:14:23 GMT
Author: sergeyb
Date: Tue Mar 26 15:14:22 2013
New Revision: 1461179

URL: http://svn.apache.org/r1461179
Log:
Merged revisions 1461175 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1461175 | sergeyb | 2013-03-26 18:11:35 +0300 (Tue, 26 Mar 2013) | 1 line
  
  [CXF-4915] Completely avoiding copying the headers
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1461175

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

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java?rev=1461179&r1=1461178&r2=1461179&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/HttpHeadersImpl.java
Tue Mar 26 15:14:22 2013
@@ -138,12 +138,18 @@ public class HttpHeadersImpl implements 
     }
 
     public MultivaluedMap<String, String> getRequestHeaders() {
-        Map<String, List<String>> newHeaders = 
-            new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
-        for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
-            newHeaders.put(entry.getKey(), getRequestHeader(entry.getKey()));
+        boolean splitIndividualValue 
+            = MessageUtils.isTrue(message.getContextualProperty(HEADER_SPLIT_PROPERTY));
+        if (splitIndividualValue) {
+            Map<String, List<String>> newHeaders = 
+                new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
+            for (Map.Entry<String, List<String>> entry : headers.entrySet())
{
+                newHeaders.put(entry.getKey(), getRequestHeader(entry.getKey()));
+            }
+            return new MetadataMap<String, String>(Collections.unmodifiableMap(newHeaders),
false);
+        } else {
+            return new MetadataMap<String, String>(Collections.unmodifiableMap(headers),
false);
         }
-        return new MetadataMap<String, String>(Collections.unmodifiableMap(newHeaders),
false);
     }
 
     public List<Locale> getAcceptableLanguages() {

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java?rev=1461179&r1=1461178&r2=1461179&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/HttpHeadersImplTest.java
Tue Mar 26 15:14:22 2013
@@ -26,6 +26,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.TreeMap;
 
 import javax.ws.rs.core.Cookie;
 import javax.ws.rs.core.HttpHeaders;
@@ -148,7 +149,7 @@ public class HttpHeadersImplTest extends
         m.get(Message.PROTOCOL_HEADERS);
         EasyMock.expectLastCall().andReturn(createHeaders());
         m.getContextualProperty("org.apache.cxf.http.header.split");
-        EasyMock.expectLastCall().andReturn("true");
+        EasyMock.expectLastCall().andReturn("true").anyTimes();
         control.replay();
         HttpHeaders h = new HttpHeadersImpl(m);
         MultivaluedMap<String, String> hs = h.getRequestHeaders();
@@ -193,9 +194,11 @@ public class HttpHeadersImplTest extends
     public void testGetContentTypeLowCase() throws Exception {
         
         Message m = new MessageImpl();
-        m.put(Message.PROTOCOL_HEADERS, 
-              Collections.singletonMap("content-type", 
-                  Collections.singletonList("text/plain")));
+        // this is what happens at runtime and is tested in the system tests
+        Map<String, List<String>> headers = 
+            new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER);
+        headers.put("content-type", Collections.singletonList("text/plain"));
+        m.put(Message.PROTOCOL_HEADERS, headers);
         HttpHeaders h = new HttpHeadersImpl(m);
         assertEquals("text/plain", h.getRequestHeaders().getFirst("Content-Type"));
     }
@@ -437,7 +440,7 @@ public class HttpHeadersImplTest extends
         
         Message m = control.createMock(Message.class);
         m.getContextualProperty("org.apache.cxf.http.header.split");
-        EasyMock.expectLastCall().andReturn("true");
+        EasyMock.expectLastCall().andReturn("true").anyTimes();
         m.get(Message.PROTOCOL_HEADERS);
         MetadataMap<String, String> headers = 
             createHeader(HttpHeaders.ACCEPT_LANGUAGE, 



Mime
View raw message