kulikg commented on code in PR #5990:
URL: https://github.com/apache/nifi/pull/5990#discussion_r869020719


##########
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/AzureStorageUtils.java:
##########
@@ -311,4 +316,38 @@ public static void setProxy(final OperationContext 
operationContext, final Proce
         final ProxyConfiguration proxyConfig = 
ProxyConfiguration.getConfiguration(processContext);
         operationContext.setProxy(proxyConfig.createProxy());
     }
+
+    public static void configureProxy(final NettyAsyncHttpClientBuilder 
nettyClientBuilder, final PropertyContext propertyContext) {
+        final ProxyConfiguration proxyConfiguration = 
ProxyConfiguration.getConfiguration(propertyContext);
+
+        if (proxyConfiguration != ProxyConfiguration.DIRECT_CONFIGURATION) {
+
+            final ProxyOptions proxyOptions = new ProxyOptions(
+                    getProxyType(proxyConfiguration),
+                    new 
InetSocketAddress(proxyConfiguration.getProxyServerHost(), 
proxyConfiguration.getProxyServerPort()));
+
+            final String proxyUserName = proxyConfiguration.getProxyUserName();
+            final String proxyUserPassword = 
proxyConfiguration.getProxyUserPassword();
+            if (proxyUserName != null && proxyUserPassword != null) {
+                proxyOptions.setCredentials(proxyUserName, proxyUserPassword);
+            }
+
+            nettyClientBuilder.proxy(proxyOptions);
+        }
+    }
+
+    private static ProxyOptions.Type getProxyType(ProxyConfiguration 
proxyConfiguration) {
+        if (proxyConfiguration.getProxyType() == Proxy.Type.HTTP) {
+            return ProxyOptions.Type.HTTP;
+        } else if (proxyConfiguration.getProxyType() == Proxy.Type.SOCKS) {
+            SocksVersion socksVersion = proxyConfiguration.getSocksVersion();

Review Comment:
   Please consider to make this variable final.



##########
nifi-nar-bundles/nifi-standard-services/nifi-proxy-configuration-bundle/nifi-proxy-configuration/src/main/java/org/apache/nifi/proxy/StandardProxyConfigurationService.java:
##########
@@ -95,7 +106,10 @@ protected List<PropertyDescriptor> 
getSupportedPropertyDescriptors() {
     @OnEnabled
     public void setConfiguredValues(final ConfigurationContext context) {
         configuration = new ProxyConfiguration();
-        
configuration.setProxyType(Proxy.Type.valueOf(context.getProperty(PROXY_TYPE).getValue()));
+
+        Proxy.Type proxyType = 
Proxy.Type.valueOf(context.getProperty(PROXY_TYPE).getValue());

Review Comment:
   Please consider to make this variable final.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to