JAL-3032 any url parameter not "j2s..." taken as Jalview args Jalview-BH/JAL-3026-JAL-3063-JAXB
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 28 Feb 2019 12:42:46 +0000 (12:42 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 28 Feb 2019 12:42:46 +0000 (12:42 +0000)
src/jalview/bin/Jalview.java

index e528dec..5527450 100755 (executable)
@@ -93,12 +93,23 @@ public class Jalview
        /**
         * @j2sNative
         * 
-        *  // set space-delimited query parameters as arguments to Jalview main
+        *  // find first query parameter (if any) that doesn't start with j2s
+        *  // and set as space-delimited arguments to Jalview main
         *      hr = decodeURI(document.location.href);
         *  pos = hr.indexOf("?");
         *  if (pos > 0)
         *  {
-        *     thisApplet.__Info.args = hr.substring(pos+1).split(" ");
+        *     q = hr.substring(pos+1);
+        *     args = q.split("&");
+        *     for (i = 0 ; i < args.length; i++)
+        *     {
+        *      arg1 = args[i];
+        *      if (!arg1.startsWith("j2s"))
+        *      {
+        *       thisApplet.__Info.args = arg1.split(" ");
+        *       break;
+        *      }
+        *     }
         *  }
         */
 
@@ -111,40 +122,26 @@ public class Jalview
 
   public static AlignFrame currentAlignFrame;
 
-//BH 2019.01.25 moved to Platform
-///**
-// * Answers true if Jalview is running as Javascript, else false. The value is
-// * set at compile time.
-// * 
-// * @return
-// */
-//public static boolean isJS()
-//{
-//  return /** @j2sNative true || */
-//  false;
-//}
-
   static
   {
     if (!Platform.isJS())
     { // BH 2018
-    // grab all the rights we can the JVM
-    Policy.setPolicy(new Policy()
-    {
-      @Override
-      public PermissionCollection getPermissions(CodeSource codesource)
-      {
-        Permissions perms = new Permissions();
-        perms.add(new AllPermission());
-        return (perms);
-      }
-
-      @Override
-      public void refresh()
-      {
-      }
-    });
-
+           // grab all the rights we can for the JVM
+           Policy.setPolicy(new Policy()
+           {
+             @Override
+             public PermissionCollection getPermissions(CodeSource codesource)
+             {
+               Permissions perms = new Permissions();
+               perms.add(new AllPermission());
+               return (perms);
+             }
+       
+             @Override
+             public void refresh()
+             {
+             }
+           });
     }
   }