com.sun.jersey.client.urlconnection.HttpURLConnectionFactory Java Examples
The following examples show how to use
com.sun.jersey.client.urlconnection.HttpURLConnectionFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecureClientUtils.java From atlas with Apache License 2.0 | 5 votes |
public URLConnectionClientHandler getUrlConnectionClientHandler() { return new URLConnectionClientHandler(new HttpURLConnectionFactory() { @Override public HttpURLConnection getHttpURLConnection(URL url) throws IOException { HttpURLConnection connection = (HttpURLConnection) url.openConnection(); if (connection instanceof HttpsURLConnection) { LOG.debug("Attempting to configure HTTPS connection using client " + "configuration"); final SSLFactory factory; final SSLSocketFactory sf; final HostnameVerifier hv; try { Configuration conf = new Configuration(); conf.addResource(conf.get(SSLFactory.SSL_CLIENT_CONF_KEY, SecurityProperties.SSL_CLIENT_PROPERTIES)); UserGroupInformation.setConfiguration(conf); HttpsURLConnection c = (HttpsURLConnection) connection; factory = getSSLFactory(conf); sf = factory.createSSLSocketFactory(); hv = factory.getHostnameVerifier(); c.setSSLSocketFactory(sf); c.setHostnameVerifier(hv); } catch (Exception e) { LOG.info("Unable to configure HTTPS connection from " + "configuration. Leveraging JDK properties."); } } return connection; } }); }
Example #2
Source File: TimelineReaderFactory.java From tez with Apache License 2.0 | 5 votes |
@Override public Client getHttpClient() { ClientConfig config = new DefaultClientConfig(JSONRootElementProvider.App.class); HttpURLConnectionFactory urlFactory = new PseudoAuthenticatedURLConnectionFactory(connectionConf); Client httpClient = new Client(new URLConnectionClientHandler(urlFactory), config); return httpClient; }
Example #3
Source File: ATSImportTool.java From tez with Apache License 2.0 | 5 votes |
private Client getHttpClient() { if (httpClient == null) { ClientConfig config = new DefaultClientConfig(JSONRootElementProvider.App.class); HttpURLConnectionFactory urlFactory = new PseudoAuthenticatedURLConnectionFactory(); return new Client(new URLConnectionClientHandler(urlFactory), config); } return httpClient; }