Class ProxyUtil


  • public class ProxyUtil
    extends java.lang.Object
    internal proxy handler
    • Constructor Summary

      Constructors 
      Constructor Description
      ProxyUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.net.URI getHostURI​(java.net.URL url)
      get the uri of the host with protocol and port for proxy selection
      static java.util.List<java.net.Proxy> getProxiesWithLocal​(java.net.URI uri)
      same as ProxySelector.getDefault() but always ensure that local is first in the list
      static java.net.Proxy getProxy​(java.lang.String url)  
      static boolean isUseSystemDefault​(boolean use)  
      static void setProxy​(java.lang.String proxy)  
      static void setProxy​(java.lang.String proxy, int port, java.lang.String user, java.lang.String pw)
      setup the environment for proxies
      static void setUseSystemDefault​(boolean use)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProxyUtil

        public ProxyUtil()
    • Method Detail

      • getHostURI

        public static java.net.URI getHostURI​(java.net.URL url)
        get the uri of the host with protocol and port for proxy selection
        Parameters:
        url -
        Returns:
      • setUseSystemDefault

        public static void setUseSystemDefault​(boolean use)
        Parameters:
        use - , if true use the system proxy properties
      • isUseSystemDefault

        public static boolean isUseSystemDefault​(boolean use)
        Parameters:
        use - , the default if not set
        Returns:
        if true use the system proxy properties
      • getProxiesWithLocal

        public static java.util.List<java.net.Proxy> getProxiesWithLocal​(java.net.URI uri)
        same as ProxySelector.getDefault() but always ensure that local is first in the list
        Parameters:
        uri -
        Returns:
      • setProxy

        public static void setProxy​(java.lang.String proxy,
                                    int port,
                                    java.lang.String user,
                                    java.lang.String pw)
        setup the environment for proxies
        Parameters:
        proxy - the proxy url - NO PORT!
        port - the proxy port
        user - the user for authentication, if null no authentication is attempted
        pw - the pass word for authentication
      • setProxy

        public static void setProxy​(java.lang.String proxy)
        Parameters:
        proxy -
      • getProxy

        public static java.net.Proxy getProxy​(java.lang.String url)