org.apache.commons.httpclient.HttpsURL Java Examples
The following examples show how to use
org.apache.commons.httpclient.HttpsURL.
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: DavGatewaySSLProtocolSocketFactory.java From davmail with GNU General Public License v2.0 | 6 votes |
/** * Register custom Socket Factory to let user accept or reject certificate */ public static void register() { String urlString = Settings.getProperty("davmail.url"); try { URL url = new URL(urlString); String protocol = url.getProtocol(); if ("https".equals(protocol)) { int port = url.getPort(); if (port < 0) { port = HttpsURL.DEFAULT_PORT; } Protocol.registerProtocol(url.getProtocol(), new Protocol(protocol, (ProtocolSocketFactory) new DavGatewaySSLProtocolSocketFactory(), port)); } } catch (MalformedURLException e) { DavGatewayTray.error(new BundleMessage("LOG_INVALID_URL", urlString)); } }
Example #2
Source File: HttpClientFactory.java From alfresco-core with GNU Lesser General Public License v3.0 | 5 votes |
protected HttpClient getHttpsClient(String httpsHost, int httpsPort) { // Configure a custom SSL socket factory that will enforce mutual authentication HttpClient httpClient = constructHttpClient(); // Default port is 443 for the HostFactory, when including customised port (like 8983) the port name is skipped from "getHostURL" string HttpHostFactory hostFactory = new HttpHostFactory(new Protocol("https", sslSocketFactory, HttpsURL.DEFAULT_PORT)); httpClient.setHostConfiguration(new HostConfigurationWithHostFactory(hostFactory)); httpClient.getHostConfiguration().setHost(httpsHost, httpsPort, "https"); return httpClient; }