quickfix for applet when opening relative URLs from feature file : https://mantis...
authorjprocter <Jim Procter>
Thu, 4 Sep 2008 12:58:50 +0000 (12:58 +0000)
committerjprocter <Jim Procter>
Thu, 4 Sep 2008 12:58:50 +0000 (12:58 +0000)
src/jalview/appletgui/AlignFrame.java

index 13c40ef..3e214b8 100755 (executable)
@@ -2374,7 +2374,20 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {
       try
       {
-        System.out.println("Show url: " + url);
+        if (url.indexOf(":")==-1)
+        {
+          // TODO: verify (Bas Vroling bug) prepend codebase or server URL to form valid URL
+          if (url.indexOf("/")==0)
+          {
+            String codebase = viewport.applet.getCodeBase().toString();
+            url = codebase.substring(0,codebase.length()-viewport.applet.getCodeBase().getFile().length())+url;
+          } else {
+            url = viewport.applet.getCodeBase()+url;
+          }
+          System.out.println("Show url (prepended codebase): " + url);
+        } else {
+          System.out.println("Show url: " + url);
+        }
         viewport.applet.getAppletContext().showDocument(
                 new java.net.URL(url), target);
       } catch (Exception ex)