Class ProxyUtil


  • public class ProxyUtil
    extends Object
    Small helper class for some common utility methods.
    Author:
    Markus Bernhardt, Copyright 2016, Bernd Rosstauscher, Copyright 2009
    • Constructor Detail

      • ProxyUtil

        public ProxyUtil()
    • Method Detail

      • parseProxySettings

        public static FixedProxySelector parseProxySettings​(String proxyVar)
        Parse host and port out of a proxy variable.
        Parameters:
        proxyVar - the proxy string. example: http://192.168.10.9:8080/
        Returns:
        a FixedProxySelector using this settings, null on parse error.
      • noProxyList

        public static List<Proxy> noProxyList()
        Gets an unmodifiable proxy list that will have as it's only entry an DIRECT proxy.
        Returns:
        a list with a DIRECT proxy in it.
      • buildPacSelectorForUrl

        public static PacProxySelector buildPacSelectorForUrl​(String url)
        Build a PAC proxy selector for the given URL.
        Parameters:
        url - to fetch the PAC script from.
        Returns:
        a PacProxySelector or null if it is not possible to build a working selector.
      • cleanIPv6

        public static String cleanIPv6​(String hostOrIP)
        This method can be used to cleanup an IPv6 address. It will remove the surrounding square brackets if found. e.g. [2001:4860:0:2001::68] will be returned as 2001:4860:0:2001::68
        Parameters:
        hostOrIP - to cleanup
        Returns:
        the raw host or IP without any IPv6 brackets.