I agree, that was done to bypass some perceived proxy issues too, but see the conclusion at

http://cxf.547215.n5.nabble.com/Why-does-CXF-JAX-RS-set-content-type-on-GET-requests-with-no-body-td5759908.html#a5760854

I'm going to update the code just in time for the incoming 3.0.7/3.1.3 releases.

In CXF 3.0.4 you can do the following as a workaround:

- use CXF AsyncHTTPConduit (in the sync mode) - this is easy to set up can provider more info if it can be of interest

- or temp set some valid CT value just to get passed the proxy

Thanks, Sergey



On 20/10/15 11:42, Khare, Aparna wrote:
Hi,

We are actually trying to hit a proxied endpoint
I have seen that the following request headers are sent from my code where I 
use the webclient to make a GET call .The code snippet is already shared in my 
previous mail


{
                                                                                                 
"name": "Accept",
                                                                                                 
"value": "*/*",
                                                                                                 
"$$hashKey": "0WF"
                                                                                
     },
                                                                                
     {
                                                                                                 
"name": "Content-Type",
                                                                                                 
"value": "*/*",
                                                                                                 
"$$hashKey": "0WI"
                                                                                
     },

Whereas when I use the same with the browser or with REST Client it works.
I feel that web client adds the content-length header by default  in case of 
GET request .
The problem is the proxied endpoint(Third party api) would fail in case the 
Content-Type Header */* is set.
To replicate the same I passed the same header in the REST client and it failed 
there as well .My only concern is that the Content-Type should not be passed by 
default .

Thanks,
Aparna

-----Original Message-----
From: Sergey Beryozkin [mailto:sberyoz...@gmail.com]
Sent: Tuesday, October 20, 2015 4:02 PM
To: users@cxf.apache.org
Subject: Re: Apache CXF overriding the Content-Type when using WebClient for GET

Hi

FYI, it is possible to disable CXF setting a CT by default in CXF 3.0.6
- and some work was done to ensure no CT is set for GET by default.

What exactly does not work ? Can you clarify please

Cheers, Sergey
On 20/10/15 11:21, Khare, Aparna wrote:
Dear Colleagues,

         I'm using version 3.0.4 .I have seen that the Content-Type is appended 
automatically in case of GET request.

The same thing works in REST client and same url does not work when I invoke 
with webclient it fails

Please see my code snippet

    WebClient rsClient = null;
      try {
        baseURI = new URI(client.getURL());
        rsClient = WebClient.create(baseURI);

        if (rsClient != null) {
          prepareClient(rsClient);
          processResponse(rsClient.get());
        }
      }

Thanks,
Aparna




--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to