public class ProxyServer
extends java.lang.Object
implements java.lang.Comparable
| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
log
Used for logging.
|
| Constructor and Description |
|---|
ProxyServer(java.lang.String proxyServer)
Creates a new
ProxyServer based on a String in the form: host:port. |
ProxyServer(java.lang.String proxyServer,
java.lang.String username,
java.lang.String password)
Creates a new
ProxyServer based on a String in the form: host:port. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(java.lang.Object object)
Required by the
Comparable interface. |
void |
dumpToLog()
Dumps the proxy server to the log.
|
boolean |
equals(java.lang.Object obj)
Overriding equals.
|
java.lang.String |
getDescription()
Gets a description of the proxy server.
|
java.lang.String |
getHost()
Gets the host.
|
java.lang.String |
getInstanceID()
For AWS proxies, this gets the instance ID.
|
java.lang.String |
getPassword() |
int |
getPort()
Gets the port.
|
java.lang.String |
getProblem()
Gets a description of a problem that may have been found with this proxy.
|
long |
getResponseTime()
Gets the amount of time it took for the HTTP response to return when this proxy was filtered.
|
java.lang.String |
getUsername() |
int |
hashCode() |
boolean |
isAlive()
Indicates whether or not the server is currently alive.
|
boolean |
isBlocked()
Indicates whether or not the proxy is blocked (as determined when validating it).
|
boolean |
isUnavailable()
Indicates whether or not the proxy is unavailable.
|
protected void |
setHost(java.lang.String host)
Sets the host.
|
protected void |
setPort(int port)
Sets the port.
|
void |
setResponseTime(long responseTime)
Sets the amount of time it took for the HTTP response to return when this proxy was filtered.
|
java.lang.String |
toString() |
boolean |
validate(int connectionTimeout,
boolean validateHost)
Validates the proxy and sets the response time.
|
boolean |
waitTillIsAlive(ScrapingSessionNotifiable notifiable)
Keeps trying till the proxy server is alive.
|
public ProxyServer(@Nullable java.lang.String proxyServer)
ProxyServer based on a String in the form: host:port.proxyServer - A String representing the proxy.public ProxyServer(@Nullable java.lang.String proxyServer, java.lang.String username, java.lang.String password)
ProxyServer based on a String in the form: host:port.proxyServer - A String representing the proxy.username - The usernamepassword - The password@Nullable public java.lang.String getHost()
protected void setHost(java.lang.String host)
host - The host.public int getPort()
protected void setPort(int port)
port - The port.@Nullable public java.lang.String getInstanceID()
public void setResponseTime(long responseTime)
responseTime - The amount of time.public long getResponseTime()
@NotNull public java.lang.String getDescription()
@Nullable public java.lang.String getProblem()
public int compareTo(java.lang.Object object)
Comparable interface.compareTo in interface java.lang.Comparableobject - The object to compare to.public boolean validate(int connectionTimeout,
boolean validateHost)
connectionTimeout - The maximum number of seconds to wait when testing each proxy.validateHost - Indicates whether or not the host should be validated as well.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - What we're comparing against.public int hashCode()
hashCode in class java.lang.Objectpublic boolean isBlocked()
public boolean isUnavailable()
public boolean isAlive()
public boolean waitTillIsAlive(ScrapingSessionNotifiable notifiable)
notifiable - So we can do logging in here.public void dumpToLog()
@NotNull public java.lang.String getUsername()
@NotNull public java.lang.String getPassword()
@NotNull public java.lang.String toString()
toString in class java.lang.Object