From: Ben Soares Date: Tue, 21 May 2024 15:31:00 +0000 (+0100) Subject: JAL-4409 Adjust usage of HttpUtils.equivalentJalviewURLString() and pass jalviewX... X-Git-Tag: Release_2_11_4_0~28^2~12 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3e47d2bafda06f0a9b959feb060f6c16c6ee014f;p=jalview.git JAL-4409 Adjust usage of HttpUtils.equivalentJalviewURLString() and pass jalviewX:// URL files to Jalview without changing them as Jalview now deals with them --- diff --git a/getdown/lib/getdown-core.jar b/getdown/lib/getdown-core.jar index ee0eb50..9a6626f 100644 Binary files a/getdown/lib/getdown-core.jar and b/getdown/lib/getdown-core.jar differ diff --git a/getdown/lib/getdown-launcher-local.jar b/getdown/lib/getdown-launcher-local.jar index 1d9e388..3ba56f5 100644 Binary files a/getdown/lib/getdown-launcher-local.jar and b/getdown/lib/getdown-launcher-local.jar differ diff --git a/getdown/lib/getdown-launcher.jar b/getdown/lib/getdown-launcher.jar index a2c6470..e6b43ab 100644 Binary files a/getdown/lib/getdown-launcher.jar and b/getdown/lib/getdown-launcher.jar differ diff --git a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java index f063a18..fca6b4d 100644 --- a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java +++ b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/Application.java @@ -1120,16 +1120,18 @@ public class Application if (! StringUtil.isBlank(_jalviewUri)) { _appargs.add(0, _jalviewUri); } + /* don't convert jalviewX:// URIs to https:// URLs as Jalview can now do that if (_appargs.size() > 0) { String jalviewUri = _appargs.get(0); log.info("Trying to parse uri '"+jalviewUri+"'"); - String jalviewUrl = HttpUtils.equivalentJalviewUrl(jalviewUri); - if (jalviewUrl != null) { + if (HttpUtils.isJalviewSchemeUri(jalviewUri)) { + String jalviewUrl = HttpUtils.equivalentJalviewUrl(jalviewUri); log.info("Turned url '"+jalviewUri+"' into '"+jalviewUrl+"'"); _appargs.clear(); _appargs.add(jalviewUrl); } } + */ for (String argString: _appargs) { if (argString.startsWith("-jvmmempc=")) { @@ -1948,14 +1950,17 @@ public class Application filename = p; } + /* Now letting Jalview convert these URIs. // convert jalviewX://... URLs if (HttpUtils.isJalviewSchemeUri(filename)) { filename = HttpUtils.equivalentJalviewUrl(filename); } + */ // check for locator file. Only allow one locator file to be double clicked (if multiple files opened, ignore locator files) if (filename.toLowerCase(Locale.ROOT).endsWith("."+Application.LOCATOR_FILE_EXTENSION)) { - setLocatorFile(filename); + // convert jalviewX://... JVL files + setLocatorFile(HttpUtils.equivalentJalviewUrl(filename)); } else { // skip any other locator files in a multiple file list addStartupFile(filename); @@ -1973,7 +1978,7 @@ public class Application } else { sb.append(' '); } - String p = changeJalviewSchemeUris && HttpUtils.isJalviewSchemeUri(f) ? HttpUtils.equivalentJalviewUrl(f) : f; + String p = changeJalviewSchemeUris ? HttpUtils.equivalentJalviewUrl(f) : f; if (p.contains(" ")) { sb.append('"'); sb.append(p); diff --git a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java index e3993d3..862c18e 100644 --- a/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java +++ b/getdown/src/getdown/core/src/main/java/com/threerings/getdown/data/EnvConfig.java @@ -150,9 +150,7 @@ public final class EnvConfig { String argvLocatorFilename = argv.length > 2 ? argv[2] : null; if (!StringUtil.isBlank(argvLocatorFilename) && argvLocatorFilename.toLowerCase(Locale.ROOT).endsWith("."+Application.LOCATOR_FILE_EXTENSION)) { - if (HttpUtils.isJalviewSchemeUri(argvLocatorFilename)) { - argvLocatorFilename = HttpUtils.equivalentJalviewUrl(argvLocatorFilename); - } + argvLocatorFilename = HttpUtils.equivalentJalviewUrl(argvLocatorFilename); notes.add(Note.info("locatorFilename in args: '"+argv[2]+"'")); Application.setLocatorFile(argvLocatorFilename); diff --git a/getdown/src/getdown/core/src/main/java/jalview/util/HttpUtils.java b/getdown/src/getdown/core/src/main/java/jalview/util/HttpUtils.java index e600c6c..04a820d 100644 --- a/getdown/src/getdown/core/src/main/java/jalview/util/HttpUtils.java +++ b/getdown/src/getdown/core/src/main/java/jalview/util/HttpUtils.java @@ -243,7 +243,8 @@ public class HttpUtils { if (!isJalviewSchemeUri(jalviewUriString)) { - return null; + // not a jalviewUriString, hand it back + return jalviewUriString; } URI jalviewUri; try @@ -255,7 +256,8 @@ public class HttpUtils } String scheme = jalviewUri.getScheme(); String host = jalviewUri.getHost(); - if (host != null && host.length() > 0) + if (host != null && host.length() > 0 + || scheme.substring(7).startsWith("http")) { URI newUri; try diff --git a/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java b/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java index 31b2538..3eb9450 100644 --- a/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java +++ b/getdown/src/getdown/launcher/src/main/java/com/threerings/getdown/launcher/GetdownApp.java @@ -311,7 +311,7 @@ public class GetdownApp } else { sb.append(' '); } - String p = changeJalviewSchemeUris && HttpUtils.isJalviewSchemeUri(f) ? HttpUtils.equivalentJalviewUrl(f) : f; + String p = changeJalviewSchemeUris ? HttpUtils.equivalentJalviewUrl(f) : f; if (p.contains(" ")) { sb.append('"'); sb.append(p); diff --git a/j11lib/getdown-core.jar b/j11lib/getdown-core.jar index ee0eb50..9a6626f 100644 Binary files a/j11lib/getdown-core.jar and b/j11lib/getdown-core.jar differ diff --git a/j8lib/getdown-core.jar b/j8lib/getdown-core.jar index ee0eb50..9a6626f 100644 Binary files a/j8lib/getdown-core.jar and b/j8lib/getdown-core.jar differ