Hi Aki
May be it is 3.0.3 or so...
I suspect that the workaround (using the async conduit) may not be
working because the client is running in OSGI and the http-hc feature is
not installed...And unfortunately, even installing it won't help,
as there was a problem with some imports,
https://issues.apache.org/jira/browse/HTTPASYNC-92
The fixed bundle was about to be released, though I'm not seeing it in
Maven...
Sergey
On 28/10/15 14:28, Aki Yoshida wrote:
are you using cxf-3.0.6?
In an older cxf version, you cannot disable the content-type header.
Please find in the mail thread that sergey linked which mentions
property set.content.type.for.empty.request.
Assuming you have 3.0.6, in that case, you can simply turn it off by
setting set.content.type.for.empty.request to false.
From 3.0.7, this property will be set false by default and no longer necessary.
2015-10-28 15:08 GMT+01:00 Khare, Aparna <[email protected]>:
Dear Colleagues,
I tried the async httpConduit as given below
HTTPConduit conduit = (HTTPConduit) WebClient.getConfig(rsClient)
.getRequestContext().put("use.async.http.conduit", true);
I'm still getting the same error. shall I move to the latest version if the fix
is given..?
Sorry If I have missed any communication on this
Thanks,
Aparna
-----Original Message-----
From: Khare, Aparna
Sent: Wednesday, October 21, 2015 1:50 PM
To: [email protected]
Subject: RE: Apache CXF overriding the Content-Type when using WebClient for GET
Hi,
I tried doing this
AsyncHTTPConduit conduit = (AsyncHTTPConduit)
WebClient.getConfig(rsClient).getConduit();
But this is also not working.
Can you please let me know when we can expect the fix as you mentioned that
this will be fixed in the coming release
Thanks,
Aparna
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Tuesday, October 20, 2015 6:09 PM
To: [email protected]
Subject: Re: Apache CXF overriding the Content-Type when using WebClient for GET
Hi
The overriding issue (well, there are actually cases when legacy 3rd
party servers do need a CT with GET :-)) was also fixed in 3.0.6 - it
was confirmed recently, re the async conduit:
add a cxf-rt-transports-http-hc dependency and set a WebClient
"use.async.http.conduit" property when doing the calls - or use
WebClient async() switch to use JAX-RS 2.0 AsyncInvoker - and do not set
that property at all
HTH, Sergey
On 20/10/15 13:30, Khare, Aparna wrote:
Thanks Sergey but what I found was that even if I pass some other Content-Type
it is not overriding and it is giving the same issue.
Meanwhile I will try using AsyncHTTPConduit
Thanks,
Aparna
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Tuesday, October 20, 2015 4:53 PM
To: [email protected]
Subject: Re: Apache CXF overriding the Content-Type when using WebClient for GET
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:[email protected]]
Sent: Tuesday, October 20, 2015 4:02 PM
To: [email protected]
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/