Github user ijokarumawak commented on the issue:

    https://github.com/apache/nifi/pull/2704
  
    @ottobackwards You are talking about these code specifically?
    ```
    HTTPUtils.setProxy(context, clientBuilder, credentialsProvider);
    ```
    
    Then yes, the above util method accepts HttpClientBuilder and useful for 
processors those only use HttpClient library. It's currently used from only 
GetHTTP and PostHTTP. It's just a convenient method for those two for now.
    
    Other processors who don't use HttpClient, uses ProxyConfiguration directly 
to get proxy settings. Following snippet is copied from AbstractAWSProcessor:
    
    ```
    // Get Proxy configuration from ProxyConfigurationService if it's used, or 
from processor's own proxy configurations, either way, the configurations are 
put into the `proxyConfig` instance. And subsequent code do not have to care 
how where these settings are set.
    final ProxyConfiguration proxyConfig = 
ProxyConfiguration.getConfiguration(context, () -> {
        if (context.getProperty(PROXY_HOST).isSet()) {
            final ProxyConfiguration componentProxyConfig = new 
ProxyConfiguration();
            String proxyHost = 
context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
            Integer proxyPort = 
context.getProperty(PROXY_HOST_PORT).evaluateAttributeExpressions().asInteger();
            String proxyUsername = 
context.getProperty(PROXY_USERNAME).evaluateAttributeExpressions().getValue();
            String proxyPassword = 
context.getProperty(PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
            componentProxyConfig.setProxyType(Proxy.Type.HTTP);
            componentProxyConfig.setProxyServerHost(proxyHost);
            componentProxyConfig.setProxyServerPort(proxyPort);
            componentProxyConfig.setProxyUserName(proxyUsername);
            componentProxyConfig.setProxyUserPassword(proxyPassword);
            return componentProxyConfig;
        }
        return ProxyConfiguration.DIRECT_CONFIGURATION;
    });
    
    // Apply Proxy settings to underlying SDK/API.
    if (Proxy.Type.HTTP.equals(proxyConfig.getProxyType())) {
        config.setProxyHost(proxyConfig.getProxyServerHost());
        config.setProxyPort(proxyConfig.getProxyServerPort());
    
        if (proxyConfig.hasCredential()) {
            config.setProxyUsername(proxyConfig.getProxyUserName());
            config.setProxyPassword(proxyConfig.getProxyUserPassword());
        }
    }
    ```
    
    Does that answer to your question?


---

Reply via email to