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)ProxyHandler(ProxyType proxyType, java.net.SocketAddress address)ProxyHandler(ProxyType proxyType, java.net.SocketAddress address, java.lang.String username, java.lang.String password)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.net.SocketAddressgetAddress()java.lang.StringgetPassword()SingleProxyAuthenticatorgetProxyAuthenticator()SingleProxySelectorgetProxySelector()ProxyTypegetProxyType()java.lang.StringgetUsername()booleanisAuthenticationSet()booleanisProxySet()ProxyHandlersetAddress(java.net.SocketAddress address)Set the proxy address.ProxyHandlersetPassword(java.lang.String password)Set the password for the proxy.ProxyHandlersetProxy(ProxyType type, java.lang.String host, int port)Set the proxy to use.ProxyHandlersetProxy(ProxyType type, java.net.SocketAddress address)Set the proxy to use.ProxyHandlersetProxyType(ProxyType type)Set the type of the proxy.ProxyHandlersetUsername(java.lang.String username)Set the username for the proxy.java.net.ProxytoJavaProxy()Create aProxyobject from this proxy.
TheProxymight not support all proxy types.ProxyHandlerunsetProxy()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)
-
ProxyHandler
public ProxyHandler(ProxyType proxyType, java.net.SocketAddress address)
-
ProxyHandler
public ProxyHandler(ProxyType proxyType, java.net.SocketAddress address, @Nullable java.lang.String username, @Nullable java.lang.String password)
-
-
Method Detail
-
setProxy
public ProxyHandler 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- Returns:
- This instance for chaining
-
setProxy
public ProxyHandler setProxy(ProxyType type, java.net.SocketAddress address)
Set the proxy to use.- Parameters:
type- The type of the proxyaddress- The address of the proxy- Returns:
- This instance for chaining
-
unsetProxy
public ProxyHandler unsetProxy()
Unset the proxy.- Returns:
- This instance for chaining
-
isProxySet
public boolean isProxySet()
- Returns:
- If the proxy is set
-
getProxyType
@Nullable public ProxyType getProxyType()
- Returns:
- The type of the proxy
-
setProxyType
public ProxyHandler setProxyType(@Nonnull ProxyType type)
Set the type of the proxy.- Parameters:
type- The type of the proxy- Returns:
- This instance for chaining
-
getAddress
@Nullable public java.net.SocketAddress getAddress()
- Returns:
- The proxy address
-
setAddress
public ProxyHandler setAddress(@Nonnull java.net.SocketAddress address)
Set the proxy address.- Parameters:
address- The proxy address- Returns:
- This instance for chaining
-
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 ProxyHandler setUsername(@Nullable java.lang.String username)
Set the username for the proxy.- Parameters:
username- The username for the proxy- Returns:
- This instance for chaining
-
getPassword
@Nullable public java.lang.String getPassword()
- Returns:
- The password for the proxy
-
setPassword
public ProxyHandler setPassword(@Nullable java.lang.String password)
Set the password for the proxy.- Parameters:
password- The password for the proxy- Returns:
- This instance for chaining
-
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
-
-