@Override public HttpConnection create(URL url, Proxy proxy) throws IOException { return new HttpClientConnection(url.toString(), null, lookupHttpClientBuilder(url).build()); }
/** {@inheritDoc} */ @Override public void connect() throws IOException { execute(); }
public void configure(KeyManager[] km, TrustManager[] tm, SecureRandom random) throws KeyManagementException { getSSLContext().init(km, tm, random); } }
private void execute() throws IOException, ClientProtocolException { if (resp != null) { return; } if (entity == null) { resp = getClient().execute(req); return; } try { if (req instanceof HttpEntityEnclosingRequest) { HttpEntityEnclosingRequest eReq = (HttpEntityEnclosingRequest) req; eReq.setEntity(entity); } resp = getClient().execute(req); } finally { entity.close(); entity = null; } }
public void connect() throws IOException { execute(); }
/** {@inheritDoc} */ @Override public void configure(KeyManager[] km, TrustManager[] tm, SecureRandom random) throws KeyManagementException { getSSLContext().init(km, tm, random); } }
private void execute() throws IOException, ClientProtocolException { if (resp == null) if (entity != null) { if (req instanceof HttpEntityEnclosingRequest) { HttpEntityEnclosingRequest eReq = (HttpEntityEnclosingRequest) req; eReq.setEntity(entity); } resp = getClient().execute(req); entity.getBuffer().close(); entity = null; } else resp = getClient().execute(req); }
/** {@inheritDoc} */ @Override public HttpConnection create(URL url) throws IOException { return new HttpClientConnection(url.toString()); }
public void connect() throws IOException { execute(); }
public void configure(KeyManager[] km, TrustManager[] tm, SecureRandom random) throws KeyManagementException { getSSLContext().init(km, tm, random); } }
private void execute() throws IOException, ClientProtocolException { if (resp != null) { return; } if (entity == null) { resp = getClient().execute(req); return; } try { if (req instanceof HttpEntityEnclosingRequest) { HttpEntityEnclosingRequest eReq = (HttpEntityEnclosingRequest) req; eReq.setEntity(entity); } resp = getClient().execute(req); } finally { entity.close(); entity = null; } }
/** {@inheritDoc} */ @Override public HttpConnection create(URL url, Proxy proxy) throws IOException { return new HttpClientConnection(url.toString(), proxy); } }
/** {@inheritDoc} */ @Override public String getResponseMessage() throws IOException { execute(); return resp.getStatusLine().getReasonPhrase(); }
getSSLContext(), hostnameverifier); clientBuilder.setSSLSocketFactory(sslConnectionFactory); Registry<ConnectionSocketFactory> registry = RegistryBuilder
public HttpConnection create(URL url, Proxy proxy) throws IOException { return new HttpClientConnection(url.toString(), proxy); } }
/** {@inheritDoc} */ @Override public int getResponseCode() throws IOException { execute(); return resp.getStatusLine().getStatusCode(); }
private HttpClient getClient() { if (client == null) client = new DefaultHttpClient(); HttpParams params = client.getParams(); if (proxy != null && !Proxy.NO_PROXY.equals(proxy)) { isUsingProxy = true; InetSocketAddress adr = (InetSocketAddress) proxy.address(); params.setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost(adr.getHostName(), adr.getPort())); } if (timeout != null) params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout.intValue()); if (readTimeout != null) params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, readTimeout.intValue()); if (followRedirects != null) params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, followRedirects.booleanValue()); if (hostnameverifier != null) { SSLSocketFactory sf; sf = new SSLSocketFactory(getSSLContext(), hostnameverifier); Scheme https = new Scheme("https", 443, sf); //$NON-NLS-1$ client.getConnectionManager().getSchemeRegistry().register(https); } return client; }
public HttpConnection create(URL url, Proxy proxy) throws IOException { return new HttpClientConnection(url.toString(), proxy); } }
public String getResponseMessage() throws IOException { execute(); return resp.getStatusLine().getReasonPhrase(); }
private HttpClient getClient() { if (client == null) client = new DefaultHttpClient(); HttpParams params = client.getParams(); if (proxy != null && !Proxy.NO_PROXY.equals(proxy)) { isUsingProxy = true; InetSocketAddress adr = (InetSocketAddress) proxy.address(); params.setParameter(ConnRoutePNames.DEFAULT_PROXY, new HttpHost(adr.getHostName(), adr.getPort())); } if (timeout != null) params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout.intValue()); if (readTimeout != null) params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, readTimeout.intValue()); if (followRedirects != null) params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, followRedirects.booleanValue()); if (hostnameverifier != null) { SSLSocketFactory sf; sf = new SSLSocketFactory(getSSLContext(), hostnameverifier); Scheme https = new Scheme("https", 443, sf); //$NON-NLS-1$ client.getConnectionManager().getSchemeRegistry().register(https); } return client; }