How to use "Apache HTTP Components Proxy Configuration" when use HttpClient API | Community
Skip to main content
Level 2
Oct 16, 2017 1:38 AM UTC
Solved

How to use "Apache HTTP Components Proxy Configuration" when use HttpClient API

Hi Experts,

I want to use the proxy settings of AEM6.2 on the Web Console  named "Apache HTTP Components Proxy Configuration" when I use HttpClient API to call a http request, but I don't know how to do it. Of course I can define my individual bundle parameters for proxy, but if the server IP was changed we should change all of the settings about proxy include no Proxy settings.

Thanks a lot.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
MC_Stuff
MC_StuffAccepted solution
Level 10
Oct 17, 2017 5:42 AM UTC

Hi Kuanqi,

Out of the box http client is fragement, so any bundle using the http api by default inherit the global settings.  So configuring proxy in osgi will work.  Just make sure you do not have another bundle embeding or exposing http api.

Thanks

3 replies

MC_Stuff
MC_StuffAccepted solution
Level 10
Oct 17, 2017 5:42 AM UTC

Hi Kuanqi,

Out of the box http client is fragement, so any bundle using the http api by default inherit the global settings.  So configuring proxy in osgi will work.  Just make sure you do not have another bundle embeding or exposing http api.

Thanks

Translate
smacdonald2008
Level 10
Oct 16, 2017 2:55 PM UTC

In addition to what Praveen stated - look here at how to use OSGi configuration nodes -- Adobe Experience Manager Help | Reading Adobe Experience Manager OSGi Configuration Values

Translate
edubey
Level 10
Oct 16, 2017 7:09 AM UTC

Hi ,

Read the configuration parameters from OSGi service and pass those as the params for HttpClient for creating the client object.

Adobe Experience Manager Help | Invoking Adobe Experience Manager Sling Servlets using Apache HTTP APIs

Thanks

Translate