Java SDK 10.1.0 usage behind a proxy

Hey everybody,
I’m using the java CDAClient to connect to contentful.
The first steps,working like a charm.
But now I have to use a Proxy to connect to contenful.
Is the some explanation how I can configure additional http properties like proxy selctors at the CDAClient.


1 Like

Hey Contentful3,

Thanks for reaching out. Depending on the depth on your use case you can choose between two options:

  1. use .setEndpoint(...) on the client builder to tell it to use that endpoint(host) instead of or

  2. if you need more control, I recommend setting up the CDAClient.Builder as usual and before calling .build to create the current, get a call factory builder like so .defaultCallFactoryBuilder(). This call factory builder contains all the setup from the CDAClient.Builder, but can also be used for more fine-grain control over the okhttp client. Once the callfactory builder is configured to your liking, you’d build (.build()) the call factory and assign it to the CDAClient.Builder by using .setCallFactory(). Now you can build the CDAClient and it’ll use the call factory provided.

I hope this makes sense and helps you.

Java SDK Developer @ Contentful

Thanks for the quick reply, I already found the mentioned solution with defaultCallFactoryBuilder() . And I will try it. So it seems to bee I’m on the right track

1 Like