List of usage examples for org.apache.commons.httpclient HttpHost HttpHost
public HttpHost(String paramString, int paramInt, Protocol paramProtocol)
From source file:ch.cyberduck.core.http.StickyHostConfiguration.java
@Override public synchronized void setHost(final String host, int port, final String scheme) { this.setHost(new HttpHost(host, port, this.getCachedProtocol(scheme))); }
From source file:au.edu.monash.merc.capture.util.httpclient.ssl.HttpHostFactory.java
/** Get a host for the given parameters. This method need not be thread-safe. */ public HttpHost getHost(HostConfiguration old, String scheme, String host, int port) { return new HttpHost(host, port, getProtocol(old, scheme, host, port)); }
From source file:au.edu.monash.merc.capture.util.httpclient.ssl.HostConfigurationWithStickyProtocol.java
public synchronized void setHost(String host, int port, String scheme) { setHost(new HttpHost(host, port, getNewProtocol(host, port, scheme))); }
From source file:org.apache.servicemix.http.processors.ProviderProcessor.java
private HostConfiguration getHostConfiguration(String locationURI, MessageExchange exchange, NormalizedMessage message) throws Exception { HostConfiguration host;/*from w w w . j ava 2 s . co m*/ URI uri = new URI(locationURI, false); if (uri.getScheme().equals("https")) { synchronized (this) { if (protocol == null) { ProtocolSocketFactory sf = new CommonsHttpSSLSocketFactory(endpoint.getSsl(), KeystoreManager.Proxy.create(endpoint.getKeystoreManager())); protocol = new Protocol("https", sf, 443); } } HttpHost httphost = new HttpHost(uri.getHost(), uri.getPort(), protocol); host = new HostConfiguration(); host.setHost(httphost); } else { host = new HostConfiguration(); host.setHost(uri.getHost(), uri.getPort()); } if (endpoint.getProxy() != null) { if ((endpoint.getProxy().getProxyHost() != null) && (endpoint.getProxy().getProxyPort() != 0)) { host.setProxy(endpoint.getProxy().getProxyHost(), endpoint.getProxy().getProxyPort()); } if (endpoint.getProxy().getProxyCredentials() != null) { endpoint.getProxy().getProxyCredentials().applyProxyCredentials(getClient(), exchange, message); } } else if ((getConfiguration().getProxyHost() != null) && (getConfiguration().getProxyPort() != 0)) { host.setProxy(getConfiguration().getProxyHost(), getConfiguration().getProxyPort()); } //host.getParams().setLongParameter(HttpConnectionParams.CONNECTION_TIMEOUT, getClient().getParams().getSoTimeout()); return host; }
From source file:org.eclipse.mylyn.internal.commons.net.CloneableHostConfiguration.java
@Override public synchronized void setHost(String host, int port, String scheme) { setHost(new HttpHost(host, port, getProtocol(host, port, scheme))); }
From source file:org.elasticsearch.hadoop.rest.commonshttp.ProtocolAwareHostConfiguration.java
public synchronized void setHost(String host, int port, String scheme) { setHost(new HttpHost(host, port, keepProtocol(host, port, scheme))); }
From source file:org.mule.transport.http.MuleHostConfiguration.java
@Override public synchronized void setHost(HttpHost host) { Protocol newProtocol = cloneProtocolKeepingSocketFactory(host.getProtocol()); HttpHost hostCopy = new HttpHost(host.getHostName(), host.getPort(), newProtocol); super.setHost(hostCopy); }
From source file:org.parosproxy.paros.network.HttpSender.java
public int executeMethod(HttpMethod method, HttpState state) throws IOException { int responseCode = -1; String hostName;//from w w w .j av a 2 s.co m hostName = method.getURI().getHost(); method.setDoAuthentication(true); HostConfiguration hc = null; HttpClient requestClient; if (param.isUseProxy(hostName)) { requestClient = clientViaProxy; } else { // ZAP: use custom client on upgrade connection and on event-source data type Header connectionHeader = method.getRequestHeader("connection"); boolean isUpgrade = connectionHeader != null && connectionHeader.getValue().toLowerCase().contains("upgrade"); // ZAP: try to apply original handling of ParosProxy requestClient = client; if (isUpgrade) { // Unless upgrade, when using another client that allows us to expose the socket // connection. requestClient = new HttpClient(new ZapHttpConnectionManager()); } } if (this.initiator == CHECK_FOR_UPDATES_INITIATOR) { // Use the 'strict' SSLConnector, ie one that performs all the usual cert checks // The 'standard' one 'trusts' everything // This is to ensure that all 'check-for update' calls are made to the expected https urls // without this is would be possible to intercept and change the response which could result // in the user downloading and installing a malicious add-on hc = new HostConfiguration() { @Override public synchronized void setHost(URI uri) { try { setHost(new HttpHost(uri.getHost(), uri.getPort(), getProtocol())); } catch (URIException e) { throw new IllegalArgumentException(e.toString()); } }; }; hc.setHost(hostName, method.getURI().getPort(), new Protocol("https", (ProtocolSocketFactory) new SSLConnector(false), 443)); if (param.isUseProxy(hostName)) { hc.setProxyHost(new ProxyHost(param.getProxyChainName(), param.getProxyChainPort())); if (param.isUseProxyChainAuth()) { requestClient.getState().setProxyCredentials(getAuthScope(param), getNTCredentials(param)); } } } // ZAP: Check if a custom state is being used if (state != null) { // Make sure cookies are enabled method.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); } responseCode = requestClient.executeMethod(hc, method, state); return responseCode; }