From: remillet Date: Fri, 15 Jan 2016 01:23:54 +0000 (-0800) Subject: CSPACE-6843: Added support for external media with HTTPS URLs. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=eb437915956ddf0af9b723d04018b420badc0906;p=tmp%2Fjakarta-migration.git CSPACE-6843: Added support for external media with HTTPS URLs. --- diff --git a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java index 222634c48..dc9e24889 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java +++ b/services/common/src/main/java/org/collectionspace/services/common/blob/BlobInput.java @@ -180,11 +180,21 @@ public class BlobInput { this.setBlobUri(blobUri); } + private boolean isProtocolHttp(URL url) { + boolean result = false; + + if (url.getProtocol().equalsIgnoreCase("http") || + url.getProtocol().equalsIgnoreCase("https")) { + result = true; + } + + return result; + } + public void createBlobFile(String theBlobUri) throws MalformedURLException, Exception { URL blobUrl = new URL(theBlobUri); File theBlobFile = null; - - if (blobUrl.getProtocol().equalsIgnoreCase("http")) { //REM: Add support for https as well + if (isProtocolHttp(blobUrl) == true) { Download fetchedFile = new Download(blobUrl); if (logger.isDebugEnabled() == true) { logger.debug("Starting blob download into temp file:" + fetchedFile.getFilePath());