Example usage for org.apache.commons.httpclient HttpsURL DEFAULT_PORT

List of usage examples for org.apache.commons.httpclient HttpsURL DEFAULT_PORT

Introduction

In this page you can find the example usage for org.apache.commons.httpclient HttpsURL DEFAULT_PORT.

Prototype

int DEFAULT_PORT

To view the source code for org.apache.commons.httpclient HttpsURL DEFAULT_PORT.

Click Source Link

Usage

From source file:davmail.http.DavGatewaySSLProtocolSocketFactory.java

/**
 * Register custom Socket Factory to let user accept or reject certificate
 *//*from  w w  w . j  a  v a 2 s .  c  o m*/
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));
    }
}