On 30/09/2014 17:29, Vincenzo Turco wrote:
ciao Francesco,
thanks for your kind help.
I'm going through the code samples e.g. the OlingoSampleApp, and got it
working nicely with my remote OData service, in a basic fashion without
authentication, SSO etc.
Then I tried to update the code with your suggestion on HttpClientFactory,
but I guess you are referring to the OData v4 client, while I need to
consume a v2 service.
So, not sure if the HttpClientFactory strategy applies also to the v2
scenario, maybe a different route could be followed to consume v2 services
with a user-defined HttpClient?

Hi Vincenzo,
you are right: everything I wrote below is about Olingo Java client 4 (which supports OData v3 and v4, but not v2).

Anyone with Olingo 2 skills out there?

Regards.

2014-09-26 9:45 GMT+02:00 Francesco Chicchiriccò <[email protected]>:

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/

Reply via email to