public final class ProxyInterface extends ListenerInterface implements ImmutableProxyInterface, IXMLEncodable, java.lang.Cloneable
ListenerInterface
class.ListenerInterface.IListenerInterfaceGetter
Modifier and Type | Field and Description |
---|---|
private static long |
AUTH_PASS_CANCEL_WAIT_TIME
Authentication stuff
|
private java.lang.String |
m_authenticationPassword
A password for http authentication.
|
private java.lang.String |
m_authenticationUserID
A user id for http authentication.
|
private long |
m_authPassLastCancelTime |
private boolean |
m_bAuthPassDialogShown |
private boolean |
m_bUseAuthentication
If the authentication strings are used.
|
private boolean |
m_bUseInterface
If the proxy is used or not.
|
private ListenerInterface |
m_listenerInterface |
private IPasswordReader |
m_passwordReader
The password reader instance.
|
private static java.lang.String |
XML_AUTHENTICATION_PASSWORD |
private static java.lang.String |
XML_AUTHENTICATION_USER_ID
The name of the xml node that stores the user id for authentication.
|
private static java.lang.String |
XML_USE_AUTHENTICATION
The name of the xml node that describes if authentication is used.
|
private static java.lang.String |
XML_USE_PROXY
The name of the xml node that describes if authentication is used.
|
PORT_MAX_VALUE, PORT_MIN_VALUE, XML_ATTR_HIDDEN, XML_ATTR_VIRTUAL, XML_ELEM_FILE, XML_ELEM_HOST, XML_ELEM_PORT, XML_ELEMENT_CONTAINER_NAME, XML_ELEMENT_NAME
PROTOCOL_STR_TYPE_HTTP, PROTOCOL_STR_TYPE_HTTPS, PROTOCOL_STR_TYPE_RAW_TCP, PROTOCOL_STR_TYPE_RAW_UDP, PROTOCOL_STR_TYPE_RAW_UNIX, PROTOCOL_STR_TYPE_SOCKS, PROTOCOL_STR_TYPE_UNKNOWN, PROTOCOL_TYPE_FTP, PROTOCOL_TYPE_HTTP, PROTOCOL_TYPE_HTTPS, PROTOCOL_TYPE_RAW_TCP, PROTOCOL_TYPE_RAW_UDP, PROTOCOL_TYPE_RAW_UNIX, PROTOCOL_TYPE_SOCKS, PROTOCOL_TYPE_UNKNOWN
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
Constructor and Description |
---|
ProxyInterface(org.w3c.dom.Element a_proxyInterfaceNode,
IPasswordReader a_passwordReader)
Creates a new ProxyInterface from XML description (ProxyInterface node).
|
ProxyInterface(ListenerInterface a_proxyInterface,
IPasswordReader a_passwordReader) |
ProxyInterface(java.lang.String a_hostname,
int a_port,
int a_protocol,
IPasswordReader a_passwordReader)
Creates a new ListenerInterface from a hostname / IP address, a port and a protocol
information.
|
ProxyInterface(java.lang.String a_hostname,
int a_port,
int a_protocol,
java.lang.String a_authenticationUserID,
IPasswordReader a_passwordReader,
boolean a_bUseAuthentication,
boolean a_bIsValid)
Creates a new interface for a proxy that needs basic http authentication.
|
ProxyInterface(java.lang.String a_hostname,
int a_port,
IPasswordReader a_passwordReader)
Creates a new interface from a hostname / IP address and a port.
|
ProxyInterface(java.lang.String a_hostname,
int a_port,
java.lang.String a_protocol,
java.lang.String a_authenticationUserID,
IPasswordReader a_passwordReader,
boolean a_bUseAuthentication,
boolean a_bIsValid)
Creates a new interface for a proxy that needs basic http authentication.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAuthenticationPassword() |
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object a_object)
Tests if two interface instances are equal.
|
java.lang.String |
getAuthenticationPassword()
Gets the authentication password of this interface.
|
private java.lang.String |
getAuthenticationPassword(boolean skipUserInteraction)
Gets the authentication password of this interface.
|
java.lang.String |
getAuthenticationUserID()
Gets the authentication user ID of this interface.
|
ListenerInterface |
getListenerInterface() |
HTTPClient.NVPair |
getProxyAuthorizationHeader()
Get the authorization header with the current user id and password.
|
java.lang.String |
getProxyAuthorizationHeaderAsString()
Gets the authorization header with the current user id and password as a String.
|
static java.lang.String |
getXMLElementName()
Gets the name of the corresponding xml element.
|
boolean |
isAuthenticationPasswordSaveable() |
boolean |
isAuthenticationUsed()
Gets if the authentication strings are used.
|
boolean |
isValid()
Returns true if the interface is valid and in use.
|
static boolean |
isValidUserID(java.lang.String a_authenticationUserID)
Gets if the given string is a valid user ID for authentication.
|
void |
setAuthenticationUserID(java.lang.String a_authenticationUserID)
Sets the authentication user ID of this interface and resets the
authentication password if the user id has changed.
|
boolean |
setUseAuthentication(boolean a_bUseAuthentication)
Sets if the authentication strings are used and reads a password form the password
reader if necessary.
|
void |
setUseInterface(boolean a_bUseInterface)
Activates and deactivates the proxy.
|
org.w3c.dom.Element |
toXmlElement(org.w3c.dom.Document a_doc)
Creates an XML node without signature and password for this ProxyInterface.
|
blockInterface, blockInterfacesFromDatabase, getBlockingTimeRemaining, getHost, getId, getPort, getProtocol, getProtocolAsString, hashCode, isBlockingRecommended, isHidden, isValidHostname, isValidIP, isValidPort, isValidProtocol, isValidProtocol, isVirtual, parseHostnamePort, parseHostnamePort, recognizeProtocol, recognizeProtocol, setHostname, setPort, setProtocol, setProtocol, toString, toVector, toXmlElementInternal, unblockInterfacesFromDatabase
finalize, getClass, notify, notifyAll, wait, wait, wait
getHost, getPort, getProtocol
private static java.lang.String XML_USE_AUTHENTICATION
private static java.lang.String XML_USE_PROXY
private static java.lang.String XML_AUTHENTICATION_USER_ID
private static java.lang.String XML_AUTHENTICATION_PASSWORD
private ListenerInterface m_listenerInterface
private java.lang.String m_authenticationPassword
private java.lang.String m_authenticationUserID
private boolean m_bUseAuthentication
private boolean m_bUseInterface
private IPasswordReader m_passwordReader
private static final long AUTH_PASS_CANCEL_WAIT_TIME
private volatile long m_authPassLastCancelTime
private boolean m_bAuthPassDialogShown
public ProxyInterface(org.w3c.dom.Element a_proxyInterfaceNode, IPasswordReader a_passwordReader) throws XMLParseException
a_proxyInterfaceNode
- The ProxyInterface node from an XML document.a_passwordReader
- the password reader; this is allowed to be null,
but then you won`t be able to use proxy authenticationXMLParseException
- if an error in the xml structure occurspublic ProxyInterface(java.lang.String a_hostname, int a_port, IPasswordReader a_passwordReader) throws java.lang.IllegalArgumentException
a_hostname
- The hostname or the IP address of this interface.a_port
- The port of this interface.a_passwordReader
- the password reader; this is allowed to be null,
but then you won`t be able to use proxy authenticationjava.lang.IllegalArgumentException
- if an illegal host name or port was givenpublic ProxyInterface(ListenerInterface a_proxyInterface, IPasswordReader a_passwordReader) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public ProxyInterface(java.lang.String a_hostname, int a_port, int a_protocol, IPasswordReader a_passwordReader) throws java.lang.IllegalArgumentException
a_hostname
- The hostname or the IP address of this interface.a_port
- The port of this interface (1 <= port <= 65535).a_protocol
- The protocol information. Invalid protocols are replaced by http.a_passwordReader
- the password reader; this is allowed to be null,
but then you won`t be able to use proxy authenticationjava.lang.IllegalArgumentException
- if an illegal host name, port or protocol was givenpublic ProxyInterface(java.lang.String a_hostname, int a_port, java.lang.String a_protocol, java.lang.String a_authenticationUserID, IPasswordReader a_passwordReader, boolean a_bUseAuthentication, boolean a_bIsValid) throws java.lang.IllegalArgumentException
a_hostname
- The hostname or the IP address of this interface.a_port
- The port of this interface (1 <= port <= 65535).a_protocol
- The protocol information. Invalid protocols are replaced by http.a_authenticationUserID
- a user ID for authenticationa_passwordReader
- the password reader; this is allowed to be null,
but then you won`t be able to use proxy authenticationa_bUseAuthentication
- true if the authentication strings are used; false otherwisea_bIsValid
- if the proxy should be used by now (true) or later (false)java.lang.IllegalArgumentException
- if an illegal host name, port or protocol was given
or if authentication should be used without password readerpublic ProxyInterface(java.lang.String a_hostname, int a_port, int a_protocol, java.lang.String a_authenticationUserID, IPasswordReader a_passwordReader, boolean a_bUseAuthentication, boolean a_bIsValid) throws java.lang.IllegalArgumentException
a_hostname
- The hostname or the IP address of this interface.a_port
- The port of this interface (1 <= port <= 65535).a_protocol
- The protocol information. Invalid protocols are replaced by http.a_authenticationUserID
- a user ID for authenticationa_passwordReader
- the password reader; this is allowed to be null,
but then you won`t be able to use proxy authenticationa_bUseAuthentication
- true if the authentication strings are used; false otherwisea_bIsValid
- if the proxy should be used by now (true) or later (false)java.lang.IllegalArgumentException
- if an illegal host name, port or protocol was given
or if authentication should be used without password readerpublic static java.lang.String getXMLElementName()
public static boolean isValidUserID(java.lang.String a_authenticationUserID)
a_authenticationUserID
- a Stringpublic boolean isAuthenticationUsed()
isAuthenticationUsed
in interface ImmutableProxyInterface
public boolean isAuthenticationPasswordSaveable()
public boolean setUseAuthentication(boolean a_bUseAuthentication) throws java.lang.IllegalStateException
a_bUseAuthentication
- true if the authentication strings should be used; false otherwisejava.lang.IllegalStateException
- if authentication should be used, but it is not possiblepublic ListenerInterface getListenerInterface()
public java.lang.String getAuthenticationPassword() throws java.lang.IllegalStateException
ImmutableProxyInterface
getAuthenticationPassword
in interface ImmutableProxyInterface
java.lang.IllegalStateException
private java.lang.String getAuthenticationPassword(boolean skipUserInteraction) throws java.lang.IllegalStateException
skipUserInteraction
- return only the currently stored value; do NOT request a new password now!java.lang.IllegalStateException
- if no password reader is registeredpublic void clearAuthenticationPassword()
public java.lang.String getAuthenticationUserID()
getAuthenticationUserID
in interface ImmutableProxyInterface
public void setAuthenticationUserID(java.lang.String a_authenticationUserID)
a_authenticationUserID
- the authentication user ID of this interfacepublic java.lang.String getProxyAuthorizationHeaderAsString() throws java.lang.IllegalStateException
getProxyAuthorizationHeaderAsString
in interface ImmutableProxyInterface
java.lang.IllegalStateException
- if the authentication mode is not activatedpublic HTTPClient.NVPair getProxyAuthorizationHeader() throws java.lang.IllegalStateException
getProxyAuthorizationHeader
in interface ImmutableProxyInterface
java.lang.IllegalStateException
- if the authentication mode is not activatedpublic java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object a_object)
equals
in class ListenerInterface
a_proxyInterface
- a ListenerInterfacepublic org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
toXmlElement
in interface IXMLEncodable
toXmlElement
in class ListenerInterface
a_doc
- The XML document, which is the environment for the created XML node.public boolean isValid()
isValid
in interface ImmutableListenerInterface
isValid
in class ListenerInterface
public void setUseInterface(boolean a_bUseInterface)
setUseInterface
in class ListenerInterface
a_bUseInterface
- booleanCopyright © 2023. All rights reserved.