cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akitoshi Yoshida (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-6538) Let users disable sending Content-Type with empty requests with URLConnection conduit
Date Tue, 18 Aug 2015 11:40:45 GMT

    [ https://issues.apache.org/jira/browse/CXF-6538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14701119#comment-14701119
] 

Akitoshi Yoshida commented on CXF-6538:
---------------------------------------

Hi Sergey,
I tested the current code and observed the following behavior.

1. when not using this new prop, CXF adds header "Content-Type: */*" to every request that
has no explicit content-type set.
2. when not using this prop, CXF falls back to the default behavior of HttpURLConnection,
which adds no content-type if not set, except for those entity-based methods PUT and POST,
where it adds header "Content-Type: application/x-www-form-urlencoded" independently of the
presence or absence of the data (i.e.., an empty or non-empty entity).
3. the use of http-proxy does not influence the behavior of above 1 and 2.
4. an explicitly set Accept is not replaced with a wildcard when using proxy.

So, I am somehow confusion again. It looks like we can just change the default CXF behavior
to use that of HttpURLConnection, no?
HttpURLConnection seems to have the bug of setting Content-Type to application/x-www-form-urlencoded
for even those non-entity based methods when the content-type was not set. And this was fixed
with http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6369510
The current 1.7 version, seems to fall back to use this default content-type for only those
entity-based methods. 

regards, aki



> Let users disable sending Content-Type with empty requests with URLConnection conduit
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-6538
>                 URL: https://issues.apache.org/jira/browse/CXF-6538
>             Project: CXF
>          Issue Type: Improvement
>          Components: Transports
>            Reporter: Sergey Beryozkin
>            Assignee: Sergey Beryozkin
>            Priority: Minor
>             Fix For: 3.1.3, 3.0.7
>
>
> If no Content-Type is set for empty requests then HttpUrlConnection:
> - sets a form Content-Type for empty POST 
> - replaces custom Accept value with a wildcard if HTTP proxy is used
> To bypass it CXF sets a wildcard CT for empty requests which causes issues if the target
server does not accept such a wildcard. 
> CXF RS code can override it with a preferred CT if needed, but sending CT with GET is
better be avoided so a new property "set.content.type.for.empty.request" is introduced (note
no 'wildcard' in the property name to let us default to something else if needed).
> The property is set to true by default. If a user sets it directly to false then CT will
be dropped. Hopefully this property can be disabled by default in the future.
> Note the issue applies to a default non-async conduit only. Setting the property is not
needed if it is the async conduit.
>  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message