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

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

Introduction

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

Prototype

public HttpsURL(String paramString1, String paramString2, String paramString3) throws URIException 

Source Link

Usage

From source file:ch.cyberduck.core.dav.DAVResource.java

public DAVResource(Host host) throws IOException {
    super(host.getProtocol().isSecure() ? new HttpsURL(host.getHostname(), host.getPort(), null)
            : new HttpURL(host.getHostname(), host.getPort(), null));
}

From source file:com.idega.slide.business.IWSlideServiceBean.java

/**
 * Gets the root url for the webdav server with authentication
 *
 * @return/*from   w  w  w  .j a  v  a  2s  .co  m*/
 */
private HttpURL getWebdavServerURL(UsernamePasswordCredentials credential, String path, String servletPath,
        boolean addSessionId) {
    try {
        String server = getIWApplicationContext().getDomain().getURL();
        if (server == null) {
            return null;
        }

        int port = 80;
        boolean https = false;
        if (server.endsWith(CoreConstants.SLASH)) {
            server = server.substring(0, server.lastIndexOf(CoreConstants.SLASH));
        }
        if (server.startsWith("http://")) {
            server = server.substring(7, server.length());
        }
        if (server.startsWith("https://")) {
            if (getIWMainApplication().getSettings().getBoolean("slide.allow.local.https")) {
                // https protocol when to slide is only enabled when this property is set
                https = true;
            }
            server = server.substring(8, server.length());
        }
        if (server.indexOf(CoreConstants.COLON) != -1) {
            String sPort = server.substring(server.indexOf(CoreConstants.COLON) + 1, server.length());
            port = Integer.parseInt(sPort);
            server = server.substring(0, server.indexOf(CoreConstants.COLON));
        }

        String rootPath = servletPath;
        String realPath = rootPath;
        if (path != null) {
            realPath = rootPath + path;
        }

        HttpURL hrl = https ? new HttpsURL(server, port, realPath) : new HttpURL(server, port, realPath);
        if (credential != null) {
            hrl.setUserinfo(credential.getUserName(), credential.getPassword());
        }

        return hrl;
    } catch (URIException e) {
        throw new IBORuntimeException(e);
    }
}