Class ProxyConfigReader

java.lang.Object
one.tranic.t.proxy.ProxyConfigReader

public class ProxyConfigReader extends Object
A utility class for reading and configuring proxy settings based on the system's environment or operating system-specific configurations. The class provides methods to retrieve proxy settings dynamically or use a static configuration, with support for both HTTP and HTTPS protocols.
  • Constructor Details

    • ProxyConfigReader

      public ProxyConfigReader()
  • Method Details

    • getProxy

      public static Proxy getProxy(Proxy proxy)
      Returns a Proxy object based on the provided proxy parameter. If the provided proxy is equal to Proxy.NO_PROXY, it falls back to a default proxy configuration by invoking the parameterless getProxy method.
      Parameters:
      proxy - the Proxy instance to be evaluated and returned if not equal to Proxy.NO_PROXY
      Returns:
      the provided proxy if it's not Proxy.NO_PROXY, or a default configured Proxy object otherwise
    • getProxy

      public static Proxy getProxy()
      Retrieves the active proxy configuration and returns a corresponding Proxy object.

      The proxy configuration is determined based on the operating system and environment variables. If no active proxy configuration is found or protocols are empty, Proxy.NO_PROXY is returned.

      Returns:
      A Proxy object representing the active proxy configuration, or Proxy.NO_PROXY if no active configuration is available.
    • getProxyConfig

      public static ProxyConfigReader.ProxyConfig getProxyConfig()
      Retrieves the proxy configuration for the current operating system.

      The method determines whether the system is running on Windows or another OS and retrieves the appropriate proxy settings accordingly.

      Returns:
      a ProxyConfigReader.ProxyConfig object containing the proxy settings for the current system. Returns configuration specific to Windows if running on Windows OS, otherwise returns configuration for Linux or Linux-like environments.