Class ProxyHandler
- java.lang.Object
-
- net.lenni0451.commons.httpclient.proxy.ProxyHandler
-
public class ProxyHandler extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ProxyHandler()ProxyHandler(ProxyType proxyType, java.lang.String host, int port)ProxyHandler(ProxyType proxyType, java.lang.String host, int port, java.lang.String username, java.lang.String password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetHost()java.lang.StringgetPassword()intgetPort()SingleProxyAuthenticatorgetProxyAuthenticator()SingleProxySelectorgetProxySelector()ProxyTypegetProxyType()java.lang.StringgetUsername()booleanisAuthenticationSet()booleanisProxySet()voidsetHost(java.lang.String host)Set the proxy host.voidsetPassword(java.lang.String password)Set the password for the proxy.voidsetPort(int port)Set the proxy port.voidsetProxy(ProxyType type, java.lang.String host, int port)Set the proxy to use.voidsetProxyType(ProxyType type)Set the type of the proxy.voidsetUsername(java.lang.String username)Set the username for the proxy.java.net.ProxytoJavaProxy()Create aProxyobject from this proxy.
TheProxymight not support all proxy types.voidunsetProxy()Unset the proxy.
-
-
-
Constructor Detail
-
ProxyHandler
public ProxyHandler()
-
ProxyHandler
public ProxyHandler(ProxyType proxyType, java.lang.String host, int port)
-
ProxyHandler
public ProxyHandler(ProxyType proxyType, java.lang.String host, int port, @Nullable java.lang.String username, @Nullable java.lang.String password)
-
-
Method Detail
-
setProxy
public void setProxy(ProxyType type, java.lang.String host, int port)
Set the proxy to use.- Parameters:
type- The type of the proxyhost- The host of the proxyport- The port of the proxy
-
unsetProxy
public void unsetProxy()
Unset the proxy.
-
isProxySet
public boolean isProxySet()
- Returns:
- If the proxy is set
-
getProxyType
@Nullable public ProxyType getProxyType()
- Returns:
- The type of the proxy
-
setProxyType
public void setProxyType(@Nonnull ProxyType type)Set the type of the proxy.- Parameters:
type- The type of the proxy
-
getHost
@Nullable public java.lang.String getHost()
- Returns:
- The proxy host
-
setHost
public void setHost(@Nonnull java.lang.String host)Set the proxy host.- Parameters:
host- The proxy host
-
getPort
public int getPort()
- Returns:
- The proxy port
-
setPort
public void setPort(int port)
Set the proxy port.- Parameters:
port- The proxy port
-
isAuthenticationSet
public boolean isAuthenticationSet()
- Returns:
- If the authentication is set
-
getUsername
@Nullable public java.lang.String getUsername()
- Returns:
- The username for the proxy
-
setUsername
public void setUsername(@Nullable java.lang.String username)Set the username for the proxy.- Parameters:
username- The username for the proxy
-
getPassword
@Nullable public java.lang.String getPassword()
- Returns:
- The password for the proxy
-
setPassword
public void setPassword(@Nullable java.lang.String password)Set the password for the proxy.- Parameters:
password- The password for the proxy
-
getProxySelector
public SingleProxySelector getProxySelector()
- Returns:
- The SingleProxySelector for this proxy
- Throws:
java.lang.IllegalStateException- If the proxy is not set
-
getProxyAuthenticator
public SingleProxyAuthenticator getProxyAuthenticator()
- Returns:
- The SingleProxyAuthenticator for this proxy
- Throws:
java.lang.IllegalStateException- If the proxy or the username/password is not set
-
toJavaProxy
public java.net.Proxy toJavaProxy()
Create aProxyobject from this proxy.
TheProxymight not support all proxy types.- Returns:
- The created
Proxyobject
-
-