本文整理了Java中org.apache.commons.httpclient.HostConfiguration.getPort()
方法的一些代码示例,展示了HostConfiguration.getPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HostConfiguration.getPort()
方法的具体详情如下:
包路径:org.apache.commons.httpclient.HostConfiguration
类名称:HostConfiguration
方法名:getPort
[英]Returns the port.
[中]返回端口。
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Returns the default port.
*
* @return The default port.
*
* @deprecated use #getHostConfiguration()
*/
public int getPort() {
return hostConfiguration.getPort();
}
代码示例来源:origin: commons-httpclient/commons-httpclient
public String getPath() {
if (this.targethost != null) {
StringBuffer buffer = new StringBuffer();
buffer.append(this.targethost.getHost());
int port = this.targethost.getPort();
if (port == -1) {
port = this.targethost.getProtocol().getDefaultPort();
}
buffer.append(':');
buffer.append(port);
return buffer.toString();
} else {
return "/";
}
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Sets the {@link HostConfiguration host configuration}.
*
* @param hostconfig The hostConfiguration to set
*
* @deprecated no longer applicable
*/
public void setHostConfiguration(final HostConfiguration hostconfig) {
if (hostconfig != null) {
this.httphost = new HttpHost(
hostconfig.getHost(),
hostconfig.getPort(),
hostconfig.getProtocol());
} else {
this.httphost = null;
}
}
代码示例来源:origin: commons-httpclient/commons-httpclient
/**
* Creates a new HTTP connection for the given host configuration.
*
* @param hostConfiguration the host/proxy/protocol to use
*/
public HttpConnection(HostConfiguration hostConfiguration) {
this(hostConfiguration.getProxyHost(),
hostConfiguration.getProxyPort(),
hostConfiguration.getHost(),
hostConfiguration.getPort(),
hostConfiguration.getProtocol());
this.localAddress = hostConfiguration.getLocalAddress();
}
代码示例来源:origin: commons-httpclient/commons-httpclient
httpConnection.setPort(hostConfiguration.getPort());
httpConnection.setProtocol(hostConfiguration.getProtocol());
httpConnection.setLocalAddress(hostConfiguration.getLocalAddress());
代码示例来源:origin: apache/cloudstack
/**
* @param username
* @param password
* @param httpClient
*/
public static void setCredentials(String username, String password, HttpClient httpClient) {
if (username != null && password != null && httpClient != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Setting credentials with username " + username + " for host " + httpClient.getHostConfiguration().getHost() + ":" + httpClient.getHostConfiguration().getPort());
}
httpClient.getParams().setAuthenticationPreemptive(true);
httpClient.getState().setCredentials(
new AuthScope(httpClient.getHostConfiguration().getHost(), httpClient.getHostConfiguration().getPort(), AuthScope.ANY_REALM), new UsernamePasswordCredentials(username, password));
}
}
代码示例来源:origin: org.apache.commons/httpclient
/**
* Returns the default port.
*
* @return The default port.
*
* @deprecated use #getHostConfiguration()
*/
public int getPort() {
return hostConfiguration.getPort();
}
代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient
/**
* Returns the default port.
*
* @return The default port.
*
* @deprecated use #getHostConfiguration()
*/
public int getPort() {
return hostConfiguration.getPort();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* Returns the default port.
*
* @return The default port.
*
* @deprecated use #getHostConfiguration()
*/
public int getPort() {
return hostConfiguration.getPort();
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
/**
* Returns the default port.
*
* @return The default port.
*
* @deprecated use #getHostConfiguration()
*/
public int getPort() {
return hostConfiguration.getPort();
}
代码示例来源:origin: apache/cloudstack
/**
* @param proxy
* @param httpClient
*/
public static void setProxy(Proxy proxy, HttpClient httpClient) {
if (proxy != null && httpClient != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Setting proxy with host " + proxy.getHost() + " and port " + proxy.getPort() + " for host " + httpClient.getHostConfiguration().getHost() + ":" + httpClient.getHostConfiguration().getPort());
}
httpClient.getHostConfiguration().setProxy(proxy.getHost(), proxy.getPort());
if (proxy.getUserName() != null && proxy.getPassword() != null) {
httpClient.getState().setProxyCredentials(AuthScope.ANY, new UsernamePasswordCredentials(proxy.getUserName(), proxy.getPassword()));
}
}
}
代码示例来源:origin: org.alfresco/alfresco-repository
public int getPort()
{
return httpClient.getHostConfiguration().getPort();
}
代码示例来源:origin: org.mule.transports/mule-transport-http
/**
* Creates a new HTTP connection for the given host configuration.
*
* @param hostConfiguration the host/proxy/protocol to use
*/
public HttpConnection(HostConfiguration hostConfiguration) {
this(hostConfiguration.getProxyHost(),
hostConfiguration.getProxyPort(),
hostConfiguration.getHost(),
hostConfiguration.getPort(),
hostConfiguration.getProtocol());
this.localAddress = hostConfiguration.getLocalAddress();
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.httpclient
/**
* Creates a new HTTP connection for the given host configuration.
*
* @param hostConfiguration the host/proxy/protocol to use
*/
public HttpConnection(HostConfiguration hostConfiguration) {
this(hostConfiguration.getProxyHost(),
hostConfiguration.getProxyPort(),
hostConfiguration.getHost(),
hostConfiguration.getPort(),
hostConfiguration.getProtocol());
this.localAddress = hostConfiguration.getLocalAddress();
}
代码示例来源:origin: org.wso2.commons-httpclient/commons-httpclient
/**
* Creates a new HTTP connection for the given host configuration.
*
* @param hostConfiguration the host/proxy/protocol to use
*/
public HttpConnection(HostConfiguration hostConfiguration) {
this(hostConfiguration.getProxyHost(),
hostConfiguration.getProxyPort(),
hostConfiguration.getHost(),
hostConfiguration.getPort(),
hostConfiguration.getProtocol());
this.localAddress = hostConfiguration.getLocalAddress();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient
/**
* Creates a new HTTP connection for the given host configuration.
*
* @param hostConfiguration the host/proxy/protocol to use
*/
public HttpConnection(HostConfiguration hostConfiguration) {
this(hostConfiguration.getProxyHost(),
hostConfiguration.getProxyPort(),
hostConfiguration.getHost(),
hostConfiguration.getPort(),
hostConfiguration.getProtocol());
this.localAddress = hostConfiguration.getLocalAddress();
}
代码示例来源:origin: org.zaproxy/zap
/**
* Creates a new HTTP connection for the given host configuration.
*
* @param hostConfiguration the host/proxy/protocol to use
*/
public HttpConnection(HostConfiguration hostConfiguration) {
this(hostConfiguration.getProxyHost(),
hostConfiguration.getProxyPort(),
hostConfiguration.getHost(),
hostConfiguration.getPort(),
hostConfiguration.getProtocol());
this.localAddress = hostConfiguration.getLocalAddress();
}
代码示例来源:origin: smartrics/RestFixture
public static URI newURI(HttpMethod m, HostConfiguration conf) throws URIException {
String scheme = conf.getProtocol().getScheme();
String host = conf.getHost();
int port = conf.getPort();
return new URIBuilder().getURI(scheme, host, port, m.getPath(),
m.getQueryString(), m.getParams());
}
}
代码示例来源:origin: Alfresco/alfresco-repository
@Test
public void testDistribution()
{
// default seed gives /woof
Pair<HttpClient, String> distributor = wrapper.getHttpClientAndBaseUrl();
assertNotNull(distributor);
assertEquals("/woof-14", distributor.getSecond());
assertEquals("common", distributor.getFirst().getHostConfiguration().getHost());
assertEquals(999, distributor.getFirst().getHostConfiguration().getPort());
}
代码示例来源:origin: Alfresco/alfresco-repository
@Test
public void testUnsharded()
{
assertTrue(unshardedWrapper.isSharded() == false);
Pair<HttpClient, String> distributor = unshardedWrapper.getHttpClientAndBaseUrl();
assertNotNull(distributor);
assertEquals("/solr4", distributor.getSecond());
assertEquals("common", distributor.getFirst().getHostConfiguration().getHost());
assertEquals(999, distributor.getFirst().getHostConfiguration().getPort());
}
内容来源于网络,如有侵权,请联系作者删除!