/** * Sets the given host and port. Uses the default protocol "http". * * @param host the host(IP or DNS name) * @param port The port */ public synchronized void setHost(final String host, int port) { setHost(host, port, Protocol.getProtocol("http")); }
/** * Returns the {@link HostConfiguration host configuration}. * * @return the host configuration * * @deprecated no longer applicable */ public HostConfiguration getHostConfiguration() { HostConfiguration hostconfig = new HostConfiguration(); hostconfig.setHost(this.httphost); return hostconfig; } /**
/** * Sets the given host, virtual host, port and protocol. * * @param host the host(IP or DNS name) * @param virtualHost the virtual host name or <code>null</code> * @param port the host port or -1 to use protocol default * @param protocol the protocol * * @deprecated #setHost(String, int, Protocol) */ public synchronized void setHost(final String host, final String virtualHost, int port, final Protocol protocol) { setHost(host, port, protocol); this.params.setVirtualHost(virtualHost); }
/** * Set the given host. Uses the default protocol("http") and its port. * * @param host The host(IP or DNS name). */ public synchronized void setHost(final String host) { Protocol defaultProtocol = Protocol.getProtocol("http"); setHost(host, defaultProtocol.getDefaultPort(), defaultProtocol); }
/** * Sets the protocol, host and port from the given URI. * @param uri the URI. */ public synchronized void setHost(final URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }
hostconfig.setHost(uri);
hostConfiguration.setHost(redirectUri); } catch (URIException ex) { throw new InvalidRedirectLocationException(
/** * Gets the host configuration for a connection. * @param conn the connection to get the configuration of * @return a new HostConfiguration */ private HostConfiguration configurationForConnection(HttpConnection conn) { HostConfiguration connectionConfiguration = new HostConfiguration(); connectionConfiguration.setHost( conn.getHost(), conn.getPort(), conn.getProtocol() ); if (conn.getLocalAddress() != null) { connectionConfiguration.setLocalAddress(conn.getLocalAddress()); } if (conn.getProxyHost() != null) { connectionConfiguration.setProxy(conn.getProxyHost(), conn.getProxyPort()); } return connectionConfiguration; }
hostConfig.setHost(new URI(escapeUri(host, sslEnabled), false)); } catch (IOException ex) { throw new EsHadoopTransportException("Invalid target URI " + host, ex);
/** * Sets the given host and port. Uses the default protocol "http". * * @param host the host(IP or DNS name) * @param port The port */ public synchronized void setHost(final String host, int port) { setHost(host, port, Protocol.getProtocol("http")); }
/** * Sets the given host and port. Uses the default protocol "http". * * @param host the host(IP or DNS name) * @param port The port */ public synchronized void setHost(final String host, int port) { setHost(host, port, Protocol.getProtocol("http")); }
@Override @SuppressWarnings("deprecation") public synchronized void setHost(String host, String virtualHost, int port, Protocol protocol) { Protocol newProtocol = cloneProtocolKeepingSocketFactory(protocol); super.setHost(host, virtualHost, port, newProtocol); }
@Override protected HostConfiguration getHostConfig(URI uri) throws Exception { HostConfiguration hostConfig = new MuleHostConfiguration(super.getHostConfig(uri)); String host = uri.getHost(); int port = uri.getPort(); Protocol protocol = getProtocol(uri.getScheme().toLowerCase()); hostConfig.setHost(host, port, protocol); return hostConfig; }
Protocol apacheProtocol = new Protocol("https", socketFactory, 443); HostConfiguration hostConfig = new HostConfiguration(); hostConfig.setHost("your.hostname.org", 443, apacheProtocol); HttpClient httpClient = new HttpClient(); httpClient.setHostConfiguration(hostConfig); ApacheHttpClientHandler handler = new ApacheHttpClientHandler(httpClient); Client client = new ApacheHttpClient(handler);
protected HttpClient getDefaultHttpClient(String httpHost, int httpPort) { HttpClient httpClient = constructHttpClient(); httpClient.getHostConfiguration().setHost(httpHost, httpPort); return httpClient; }
/** * Set the given host. Uses the default protocol("http") and its port. * * @param host The host(IP or DNS name). */ public synchronized void setHost(final String host) { Protocol defaultProtocol = Protocol.getProtocol("http"); setHost(host, defaultProtocol.getDefaultPort(), defaultProtocol); }
/** * Sets the protocol, host and port from the given URI. * @param uri the URI. */ public synchronized void setHost(final URI uri) { try { setHost(uri.getHost(), uri.getPort(), uri.getScheme()); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }
@Override public synchronized void setHost(HttpHost host) { Protocol newProtocol = cloneProtocolKeepingSocketFactory(host.getProtocol()); HttpHost hostCopy = new HttpHost(host.getHostName(), host.getPort(), newProtocol); super.setHost(hostCopy); }
protected HttpClient getHttpsClient(String httpsHost, int httpsPort) { // Configure a custom SSL socket factory that will enforce mutual authentication HttpClient httpClient = constructHttpClient(); HttpHostFactory hostFactory = new HttpHostFactory(new Protocol("https", sslSocketFactory, httpsPort)); httpClient.setHostConfiguration(new HostConfigurationWithHostFactory(hostFactory)); httpClient.getHostConfiguration().setHost(httpsHost, httpsPort, "https"); return httpClient; }
protected HttpClient getHttpsClient() { // Configure a custom SSL socket factory that will enforce mutual authentication HttpClient httpClient = constructHttpClient(); HttpHostFactory hostFactory = new HttpHostFactory(new Protocol("https", sslSocketFactory, sslPort)); httpClient.setHostConfiguration(new HostConfigurationWithHostFactory(hostFactory)); httpClient.getHostConfiguration().setHost(host, sslPort, "https"); return httpClient; }