On 25/09/2014 19:06, Vincenzo Turco wrote:
Hi all,
I'd like to use Olingo as client to my OData services.
My current application server runtime can provide an HttpClient instance.
I'd like to pass this object to Olingo API so that connection to the OData
endpoint could take place through it.
This would be important because the HttpClient instance already has lots of
authentication properties configured by the application server runtime.
Could anyone please direct me to relevant docs?
Hi Vincenzo,
if you want to provide your own HttpClient instance, you'll need to
1. create your own org.apache.olingo.client.api.http.HttpClientFactory
implementation (or just extend
org.apache.olingo.client.core.http.AbstractHttpClientFactory)
2. set your client instance to use your own HttpClientFactory and not
org.apache.olingo.client.core.http.DefaultHttpClientFactory which is -
not surprisingly - the default
client.getConfiguration().setHttpClientFactory(yourOwnFactory);
There are some client factories provided for common usages - basic
authentication, NTLM authentication, OAuth 2.0, proxy - in [1] and
more samples of how to customize the HttpClient instances under [2].
HTH
Regards.
[1]
https://git-wip-us.apache.org/repos/asf?p=olingo-odata4.git;a=tree;f=lib/client-core/src/main/java/org/apache/olingo/client/core/http
[2]
https://git-wip-us.apache.org/repos/asf?p=olingo-odata4.git;a=tree;f=samples/client/src/main/java/org/apache/olingo/samples/client/core/http
--
Francesco Chicchiriccò
Tirasa - Open Source Excellence
http://www.tirasa.net/
Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/