You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "James Y. Li" <yu...@gmail.com> on 2015/07/23 05:55:32 UTC
WebClient.create() ?
Hi All,
I am trying to do a filtering on ciphersuites used for SSL connection with
WebClient. I noticed that I can do a sec:cipherSuitesFilter
in cxf.xml, as following:
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport
But could I pass in a cxf.xml as a parameter of 'configLocation' for
WebClient.*create
<https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxrs/client/WebClient.html#create(java.lang.String,%20java.util.List,%20java.lang.String)>*
(String
<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true>
baseAddress, List
<http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true>
<?> providers, String
<http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true>
configLocation) ? Is the 'configLocation' here supposed to take a cxf.xml?
Also 'configLocation' and 'threadSafe' look mutually exclusive for
WebClient.create(), which means I cannot find a signature with both. Is
that by design? And what if I need to set 'threadSafe' to true and pass in
a 'configLocation' at the same time?
Here is the docs for WebClient class:
https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxrs/client/WebClient.html
Thanks,
-james
Re: WebClient.create() ?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 23/07/15 06:55, James Y. Li wrote:
> Hi All,
> I am trying to do a filtering on ciphersuites used for SSL connection with
> WebClient. I noticed that I can do a sec:cipherSuitesFilter
> in cxf.xml, as following:
>
> http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport(includingSSLsupport)-ConfiguringSSLSupport
>
> But could I pass in a cxf.xml as a parameter of 'configLocation' for
> WebClient.*create
> <https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxrs/client/WebClient.html#create(java.lang.String,%20java.util.List,%20java.lang.String)>*
> (String
> <http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true>
> baseAddress, List
> <http://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true>
> <?> providers, String
> <http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true>
> configLocation) ? Is the 'configLocation' here supposed to take a cxf.xml?
>
Indeed, it points to the context configuration, which is expected to be
a classpath resource, I checked the tests, I see:
org/apache/cxf/systest/jaxrs/security/jaxrs-https-client1.xml,
etc.
Another option is to use SpringBusFactory:
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSJweJwsTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
BusFactory.setDefaultBus(springBus);
and avoid passing a context location to WebClient.create
> Also 'configLocation' and 'threadSafe' look mutually exclusive for
> WebClient.create(), which means I cannot find a signature with both. Is
> that by design? And what if I need to set 'threadSafe' to true and pass in
> a 'configLocation' at the same time?
Yes, I was trying to avoid creating a constructor per every possible
combination. If you can not find a suitable constructor then use
JAXRSClientFactoryBean, set address, providers, other properties,
create bus as shown above but set it directly on the bean and do
.createWebClient.
Sergey
>
> Here is the docs for WebClient class:
> https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxrs/client/WebClient.html
>
> Thanks,
> -james
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com