kumuluz / kumuluzee

Lightweight open-source framework for developing microservices using standard Java EE technologies and migrating Java EE to cloud-native architecture.
https://ee.kumuluz.com
MIT License
291 stars 71 forks source link

RestClient does not support proxy #152

Closed marcelorubim closed 4 years ago

marcelorubim commented 5 years ago

On the company that I work we need to go through to access external sites.

We are adopting KumuluzEE as the framework for our microservices. Currently the RestClient implementation does not support to add a proxy configuration like we can do with a pure Jersey client as shown bellow

ClientConfig config = new ClientConfig(); config.property(ClientProperties.PROXY_URI, "http://proxy_url"); config.property(ClientProperties.PROXY_USERNAME, "proxy_user"); config.property(ClientProperties.PROXY_PASSWORD, "proxy_password"); config.connectorProvider(new ApacheConnectorProvider()); Client client = ClientBuilder.newClient(config);

Are there any plans to add this?

urbim commented 5 years ago

Hi! We will take a look at it.

marcelorubim commented 5 years ago

As we were needing it, I did some changes on the kumuluzee-rest-client. Probably I'll be submiting a Pull Request within a couple of days

urbim commented 5 years ago

That would be great. Thank you!

cen1 commented 5 years ago

Jersey 2.29 allows registering a JettyHttpClientSupplier so if you write your own producer method for MP rest Client this should already be possible (with jersey version bump), see https://github.com/eclipse-ee4j/jersey/pull/4089/commits/6a83e77aa444279f0e1eee2cd850588361468589

I think in general, the best approach would be to expose this in MP Rest Client and allow developer to pass their own HttpClient instance, or in this case, the supplier implementation. Adding single config option now inevitably means that you would either need to expose all config options or patch them in every time someone else needs one.