APISonar


org.apache.cloudstack.agent.directdownload.DirectDownloadCommand.DownloadProtocol.HTTP

> org > apache > cloudstack > agent > directdownload > DirectDownloadCommand > DownloadProtocol > HTTP
org APIs apache APIs cloudstack APIs agent APIs directdownload APIs DirectDownloadCommand APIs DownloadProtocol APIs HTTP APIs

Example 1
public void testGetProtocolHttp() {
        String url = "http://192.168.1.2/tmpl.qcow2";
        DownloadProtocol protocol = DirectDownloadManagerImpl.getProtocolFromUrl(url);
        Assert.assertEquals(DownloadProtocol.HTTP, protocol);
    }
Example 2
private DirectDownloadCommand getDirectDownloadCommandFromProtocol(DownloadProtocol protocol, String url, Long templateId, PrimaryDataStoreTO destPool,
                                                                       String checksum, Map<String, String> httpHeaders) {
        if (protocol.equals(DownloadProtocol.HTTP)) {
            return new HttpDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders);
        } else if (protocol.equals(DownloadProtocol.HTTPS)) {
            return new HttpsDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders);
        } else if (protocol.equals(DownloadProtocol.NFS)) {
            return new NfsDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders);
        } else if (protocol.equals(DownloadProtocol.METALINK)) {
            return new MetalinkDirectDownloadCommand(url, templateId, destPool, checksum, httpHeaders);
        } else {
            return null;
        }
    }