Package com.fathzer.plugin.loader.utils
Class ProxySettings
java.lang.Object
com.fathzer.plugin.loader.utils.ProxySettings
A class that represents a proxy setting.
-
Constructor Summary
ConstructorsConstructorDescriptionProxySettings(String host, int port, PasswordAuthentication login) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic ProxySettingsfromString(String proxy) Creates a proxy setting from a string.Gets the login converted to a Base64 string.getHost()Gets the proxy's host name.getLogin()Gets the proxy's user login.intgetPort()Gets the proxy's port.toProxy()Converts this to a java.net.Proxy instance.toString()
-
Constructor Details
-
ProxySettings
Constructor.- Parameters:
host- The proxy's host nameport- The proxy's portlogin- The login used for authentication (null if no authentication)
-
-
Method Details
-
fromString
Creates a proxy setting from a string.- Parameters:
proxy- The address in the format [user:[password]@]host:port- Returns:
- A proxy setting or null if argument is null or empty
- Throws:
IllegalArgumentException- if argument is incorrect
-
toProxy
Converts this to a java.net.Proxy instance.- Returns:
- a Proxy instance
-
getHost
Gets the proxy's host name.- Returns:
- a string
-
getPort
public int getPort()Gets the proxy's port.- Returns:
- a integer
-
getLogin
Gets the proxy's user login.- Returns:
- a string or null if no authentication is set
-
getBase64Login
Gets the login converted to a Base64 string.
The content is user:pwd encoded in base 64. It can be used with "Basic " prefix in "Proxy-Authorization" http header.- Returns:
- a base64 string or null is no login is defined
-
toString
-