下面列出了怎么用org.apache.commons.httpclient.params.HostParams的API类实例代码及写法,或者点击链接到github查看源代码。
private void init(final HostConfiguration hostConfiguration) {
// wrap all of the assignments in a synchronized block to avoid
// having to negotiate the monitor for each method call
synchronized (hostConfiguration) {
try {
if (hostConfiguration.host != null) {
this.host = (HttpHost) hostConfiguration.host.clone();
} else {
this.host = null;
}
if (hostConfiguration.proxyHost != null) {
this.proxyHost = (ProxyHost) hostConfiguration.proxyHost.clone();
} else {
this.proxyHost = null;
}
this.localAddress = hostConfiguration.getLocalAddress();
this.params = (HostParams)hostConfiguration.getParams().clone();
} catch (CloneNotSupportedException e) {
throw new IllegalArgumentException("Host configuration could not be cloned");
}
}
}
/**
* Assigns {@link HostParams HTTP protocol parameters} specific to this host.
*
* @since 3.0
*
* @see HostParams
*/
public void setParams(final HostParams params) {
if (params == null) {
throw new IllegalArgumentException("Parameters may not be null");
}
this.params = params;
}
/**
* Returns {@link HostParams HTTP protocol parameters} associated with this host.
*
* @return HTTP parameters.
*
* @since 3.0
*/
public HostParams getParams() {
return this.params;
}