cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6648] CT should be dropped for GETs by default
Date Wed, 21 Oct 2015 11:48:05 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 0f990ec1f -> 861cea30e


[CXF-6648] CT should be dropped for GETs by default


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

Branch: refs/heads/3.0.x-fixes
Commit: 861cea30e5870ff1336c16964f206cb16e19fc85
Parents: 0f990ec
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Wed Oct 21 12:47:03 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Wed Oct 21 12:47:50 2015 +0100

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/861cea30/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 7238fc1..b8ed562 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
@@ -305,8 +305,16 @@ public class Headers {
         boolean dropContentType = false;
         boolean emptyRequest = PropertyUtils.isTrue(message.get(EMPTY_REQUEST_PROPERTY));
         if (emptyRequest) { 
-            // drop only if a user explicitly requested it by setting the property to false
-            dropContentType = !MessageUtils.getContextualBoolean(message, SET_EMPTY_REQUEST_CT_PROPERTY,
true);
+            Object setCtForEmptyRequestProp = message.getContextualProperty(SET_EMPTY_REQUEST_CT_PROPERTY);
+            if (setCtForEmptyRequestProp != null) {
+                // If SET_EMPTY_REQUEST_CT_PROPERTY is set then do as a user prefers.
+                // CT will be dropped if setting CT for empty requests was explicitly disabled
+                dropContentType = PropertyUtils.isFalse(setCtForEmptyRequestProp);
+            } else if ("GET".equals((String)message.get(Message.HTTP_REQUEST_METHOD))) {
+                // otherwise if it is GET then just drop it
+                dropContentType = true;
+            }
+            
         }
         if (!dropContentType) {
             String ct = emptyRequest && !headers.containsKey(Message.CONTENT_TYPE)
? "*/*" : determineContentType();


Mime
View raw message