You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2015/10/30 16:33:07 UTC
[5/9] cxf git commit: [CXF-6648] CT should be dropped for GETs by
default
[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/5c08c8d8
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5c08c8d8
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5c08c8d8
Branch: refs/heads/2.7.x-fixes
Commit: 5c08c8d80e20f1afb8d28dcd2a184496537522ee
Parents: de02871
Author: Sergey Beryozkin <sb...@gmail.com>
Authored: Wed Oct 21 12:47:03 2015 +0100
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Oct 30 11:06:01 2015 -0400
----------------------------------------------------------------------
.../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/5c08c8d8/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 f3a63b9..310fa2a 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
@@ -295,8 +295,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();