cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Avoiding setting a wildcard if AsyncConduit is used
Date Wed, 11 Feb 2015 13:16:05 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 41a5659e8 -> 46f271b69


Avoiding setting a wildcard if AsyncConduit is used


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/46f271b6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/46f271b6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/46f271b6

Branch: refs/heads/master
Commit: 46f271b6977bac1fde92647aab51f3aa6a9f11f2
Parents: 41a5659
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Feb 11 13:15:43 2015 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Feb 11 13:15:43 2015 +0000

----------------------------------------------------------------------
 .../java/org/apache/cxf/transport/http/Headers.java     | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/46f271b6/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
index 83f31e1..5507f40 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Headers.java
@@ -68,6 +68,7 @@ public class Headers {
     public static final String HTTP_HEADERS_SETCOOKIE = "Set-Cookie";
     public static final String HTTP_HEADERS_LINK = "Link";
     public static final String EMPTY_REQUEST_PROPERTY = "org.apache.cxf.empty.request";
+    private static final String USE_ASYNC_PROPERTY = "use.async.http.conduit";
     private static final TimeZone TIME_ZONE_GMT = TimeZone.getTimeZone("GMT");
     private static final Logger LOG = LogUtils.getL7dLogger(Headers.class);
     
@@ -298,10 +299,13 @@ public class Headers {
      */
     public void setProtocolHeadersInConnection(HttpURLConnection connection) throws IOException
{
         boolean emptyRequest = PropertyUtils.isTrue(message.get(EMPTY_REQUEST_PROPERTY));
-        // Apparently HttpUrlConnection sets a form Content-Type 
-        // if no Content-Type is set even for empty requests 
-        String ct = emptyRequest ? "*/*" : determineContentType();
-        connection.setRequestProperty(HttpHeaderHelper.CONTENT_TYPE, ct);
+        // HttpUrlConnection sets a form Content-Type and completely loses custom Accept

+        // if HTTP proxies are used if no Content-Type is set for empty requests 
+        boolean asyncConduitUsed = PropertyUtils.isTrue(message.get(USE_ASYNC_PROPERTY));
+        if (!asyncConduitUsed || !emptyRequest) {
+            String ct = emptyRequest ? "*/*" : determineContentType();
+            connection.setRequestProperty(HttpHeaderHelper.CONTENT_TYPE, ct);
+        }
          
         transferProtocolHeadersToURLConnection(connection);
         logProtocolHeaders(Level.FINE);


Mime
View raw message