Package one.tranic.t.base.parse.proxy
Class ProxyConfigReader
java.lang.Object
one.tranic.t.base.parse.proxy.ProxyConfigReader
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ProxyConfigReader
public ProxyConfigReader()
-
-
Method Details
-
getProxy
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
Retrieves the active proxy configuration and returns a correspondingProxyobject.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_PROXYis returned.- Returns:
- A
Proxyobject representing the active proxy configuration, orProxy.NO_PROXYif no active configuration is available.
-
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.ProxyConfigobject 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.
-