Constructors Summary |
---|
public ProxyInfo(String host, int port, String exclList)Create a ProxyProperties that points at a HTTP Proxy.
mHost = host;
mPort = port;
setExclusionList(exclList);
mPacFileUrl = Uri.EMPTY;
|
public ProxyInfo(Uri pacFileUrl)Create a ProxyProperties that points at a PAC URL.
mHost = LOCAL_HOST;
mPort = LOCAL_PORT;
setExclusionList(LOCAL_EXCL_LIST);
if (pacFileUrl == null) {
throw new NullPointerException();
}
mPacFileUrl = pacFileUrl;
|
public ProxyInfo(String pacFileUrl)Create a ProxyProperties that points at a PAC URL.
mHost = LOCAL_HOST;
mPort = LOCAL_PORT;
setExclusionList(LOCAL_EXCL_LIST);
mPacFileUrl = Uri.parse(pacFileUrl);
|
public ProxyInfo(Uri pacFileUrl, int localProxyPort)Only used in PacManager after Local Proxy is bound.
mHost = LOCAL_HOST;
mPort = localProxyPort;
setExclusionList(LOCAL_EXCL_LIST);
if (pacFileUrl == null) {
throw new NullPointerException();
}
mPacFileUrl = pacFileUrl;
|
private ProxyInfo(String host, int port, String exclList, String[] parsedExclList)
mHost = host;
mPort = port;
mExclusionList = exclList;
mParsedExclusionList = parsedExclList;
mPacFileUrl = Uri.EMPTY;
|
public ProxyInfo(ProxyInfo source)
if (source != null) {
mHost = source.getHost();
mPort = source.getPort();
mPacFileUrl = source.mPacFileUrl;
mExclusionList = source.getExclusionListAsString();
mParsedExclusionList = source.mParsedExclusionList;
} else {
mPacFileUrl = Uri.EMPTY;
}
|
Methods Summary |
---|
public static android.net.ProxyInfo | buildDirectProxy(java.lang.String host, int port)Constructs a {@link ProxyInfo} object that points at a Direct proxy
on the specified host and port.
return new ProxyInfo(host, port, null);
|
public static android.net.ProxyInfo | buildDirectProxy(java.lang.String host, int port, java.util.List exclList)Constructs a {@link ProxyInfo} object that points at a Direct proxy
on the specified host and port.
The proxy will not be used to access any host in exclusion list, exclList.
String[] array = exclList.toArray(new String[exclList.size()]);
return new ProxyInfo(host, port, TextUtils.join(",", array), array);
|
public static android.net.ProxyInfo | buildPacProxy(Uri pacUri)Construct a {@link ProxyInfo} that will download and run the PAC script
at the specified URL.
return new ProxyInfo(pacUri);
|
public int | describeContents()Implement the Parcelable interface
return 0;
|
public boolean | equals(java.lang.Object o)
if (!(o instanceof ProxyInfo)) return false;
ProxyInfo p = (ProxyInfo)o;
// If PAC URL is present in either then they must be equal.
// Other parameters will only be for fall back.
if (!Uri.EMPTY.equals(mPacFileUrl)) {
return mPacFileUrl.equals(p.getPacFileUrl()) && mPort == p.mPort;
}
if (!Uri.EMPTY.equals(p.mPacFileUrl)) {
return false;
}
if (mExclusionList != null && !mExclusionList.equals(p.getExclusionListAsString())) {
return false;
}
if (mHost != null && p.getHost() != null && mHost.equals(p.getHost()) == false) {
return false;
}
if (mHost != null && p.mHost == null) return false;
if (mHost == null && p.mHost != null) return false;
if (mPort != p.mPort) return false;
return true;
|
public java.lang.String[] | getExclusionList()When configured to use a Direct Proxy this returns the list
of hosts for which the proxy is ignored.
return mParsedExclusionList;
|
public java.lang.String | getExclusionListAsString()comma separated
return mExclusionList;
|
public java.lang.String | getHost()When configured to use a Direct Proxy this returns the host
of the proxy.
return mHost;
|
public Uri | getPacFileUrl()Returns the URL of the current PAC script or null if there is
no PAC script.
return mPacFileUrl;
|
public int | getPort()When configured to use a Direct Proxy this returns the port
of the proxy
return mPort;
|
public java.net.InetSocketAddress | getSocketAddress()
InetSocketAddress inetSocketAddress = null;
try {
inetSocketAddress = new InetSocketAddress(mHost, mPort);
} catch (IllegalArgumentException e) { }
return inetSocketAddress;
|
public int | hashCode()
return ((null == mHost) ? 0 : mHost.hashCode())
+ ((null == mExclusionList) ? 0 : mExclusionList.hashCode())
+ mPort;
|
public boolean | isValid()
if (!Uri.EMPTY.equals(mPacFileUrl)) return true;
return Proxy.PROXY_VALID == Proxy.validate(mHost == null ? "" : mHost,
mPort == 0 ? "" : Integer.toString(mPort),
mExclusionList == null ? "" : mExclusionList);
|
public java.net.Proxy | makeProxy()
java.net.Proxy proxy = java.net.Proxy.NO_PROXY;
if (mHost != null) {
try {
InetSocketAddress inetSocketAddress = new InetSocketAddress(mHost, mPort);
proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, inetSocketAddress);
} catch (IllegalArgumentException e) {
}
}
return proxy;
|
private void | setExclusionList(java.lang.String exclusionList)
mExclusionList = exclusionList;
if (mExclusionList == null) {
mParsedExclusionList = new String[0];
} else {
mParsedExclusionList = exclusionList.toLowerCase(Locale.ROOT).split(",");
}
|
public java.lang.String | toString()
StringBuilder sb = new StringBuilder();
if (!Uri.EMPTY.equals(mPacFileUrl)) {
sb.append("PAC Script: ");
sb.append(mPacFileUrl);
}
if (mHost != null) {
sb.append("[");
sb.append(mHost);
sb.append("] ");
sb.append(Integer.toString(mPort));
if (mExclusionList != null) {
sb.append(" xl=").append(mExclusionList);
}
} else {
sb.append("[ProxyProperties.mHost == null]");
}
return sb.toString();
|
public void | writeToParcel(android.os.Parcel dest, int flags)Implement the Parcelable interface.
if (!Uri.EMPTY.equals(mPacFileUrl)) {
dest.writeByte((byte)1);
mPacFileUrl.writeToParcel(dest, 0);
dest.writeInt(mPort);
return;
} else {
dest.writeByte((byte)0);
}
if (mHost != null) {
dest.writeByte((byte)1);
dest.writeString(mHost);
dest.writeInt(mPort);
} else {
dest.writeByte((byte)0);
}
dest.writeString(mExclusionList);
dest.writeStringArray(mParsedExclusionList);
|