Author: veithen
Date: Sun Feb  1 11:22:39 2009
New Revision: 739741

URL: http://svn.apache.org/viewvc?rev=739741&view=rev
Log:
Moved the proxy configuration code to a better place.

Modified:
    
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Configuration.java
    
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Connection.java
    
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-eclipse-plugin/src/main/java/org/apache/ws/commons/tcpmon/eclipse/ui/Listener.java
    
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-ui/src/main/java/org/apache/ws/commons/tcpmon/Listener.java

Modified: 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Configuration.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Configuration.java?rev=739741&r1=739740&r2=739741&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Configuration.java
 (original)
+++ 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Configuration.java
 Sun Feb  1 11:22:39 2009
@@ -28,6 +28,21 @@
     private int httpProxyPort;
     private SlowLinkSimulator slowLink;
     
+    public void configProxyFromSystemProperties() {
+        String host = System.getProperty("http.proxyHost");
+        if (host != null && host.length() > 0) {
+            httpProxyHost = host;
+            String port = System.getProperty("http.proxyPort");
+            if (port != null && port.length() > 0) {
+                httpProxyPort = Integer.parseInt(port);
+            } else {
+                httpProxyPort = 80;
+            }
+        } else {
+            httpProxyHost = null;
+        }
+    }
+    
     public int getListenPort() {
         return listenPort;
     }

Modified: 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Connection.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Connection.java?rev=739741&r1=739740&r2=739741&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Connection.java
 (original)
+++ 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/Connection.java
 Sun Feb  1 11:22:39 2009
@@ -101,23 +101,6 @@
             active = true;
             String HTTPProxyHost = config.getHttpProxyHost();
             int HTTPProxyPort = config.getHttpProxyPort();
-            if (HTTPProxyHost == null) {
-                HTTPProxyHost = System.getProperty("http.proxyHost");
-                if ((HTTPProxyHost != null) && HTTPProxyHost.equals("")) {
-                    HTTPProxyHost = null;
-                }
-                if (HTTPProxyHost != null) {
-                    String tmp = System.getProperty("http.proxyPort");
-                    if ((tmp != null) && tmp.equals("")) {
-                        tmp = null;
-                    }
-                    if (tmp == null) {
-                        HTTPProxyPort = 80;
-                    } else {
-                        HTTPProxyPort = Integer.parseInt(tmp);
-                    }
-                }
-            }
             String fromHost;
             if (inSocket != null) {
                 fromHost = (inSocket.getInetAddress()).getHostName();

Modified: 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-eclipse-plugin/src/main/java/org/apache/ws/commons/tcpmon/eclipse/ui/Listener.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-eclipse-plugin/src/main/java/org/apache/ws/commons/tcpmon/eclipse/ui/Listener.java?rev=739741&r1=739740&r2=739741&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-eclipse-plugin/src/main/java/org/apache/ws/commons/tcpmon/eclipse/ui/Listener.java
 (original)
+++ 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-eclipse-plugin/src/main/java/org/apache/ws/commons/tcpmon/eclipse/ui/Listener.java
 Sun Feb  1 11:22:39 2009
@@ -617,8 +617,12 @@
                 config.setXmlFormat(xmlFormatBox.getSelection());
             }
         });
-        config.setHttpProxyHost(HTTPProxyHost);
-        config.setHttpProxyPort(HTTPProxyPort);
+        if (HTTPProxyHost == null) {
+            config.configProxyFromSystemProperties();
+        } else {
+            config.setHttpProxyHost(HTTPProxyHost);
+            config.setHttpProxyPort(HTTPProxyPort);
+        }
         config.setSlowLink(slowLink);
         return config;
     }

Modified: 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-ui/src/main/java/org/apache/ws/commons/tcpmon/Listener.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/tcpmon/modules/tcpmon-ui/src/main/java/org/apache/ws/commons/tcpmon/Listener.java?rev=739741&r1=739740&r2=739741&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-ui/src/main/java/org/apache/ws/commons/tcpmon/Listener.java
 (original)
+++ 
webservices/commons/trunk/modules/tcpmon/modules/tcpmon-ui/src/main/java/org/apache/ws/commons/tcpmon/Listener.java
 Sun Feb  1 11:22:39 2009
@@ -594,8 +594,12 @@
         config.setTargetPort(Integer.parseInt(tPortField.getText()));
         config.setProxy(isProxyBox.isSelected());
         config.setXmlFormat(xmlFormatBox.isSelected());
-        config.setHttpProxyHost(HTTPProxyHost);
-        config.setHttpProxyPort(HTTPProxyPort);
+        if (HTTPProxyHost == null) {
+            config.configProxyFromSystemProperties();
+        } else {
+            config.setHttpProxyHost(HTTPProxyHost);
+            config.setHttpProxyPort(HTTPProxyPort);
+        }
         config.setSlowLink(slowLink);
         return config;
     }


Reply via email to