Changeset 32139 for main/trunk/gli
- Timestamp:
- 2018-02-13T20:45:29+13:00 (6 years ago)
- Location:
- main/trunk/gli
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/GLIapplet.jnlp
r32138 r32139 20 20 */ 21 21 --> 22 <!--23 /*24 * https://docs.oracle.com/javase/9/deploy/migrating-java-applets-jnlp.htm#JSDPG-GUID-1F95EBB3-D5CB-434A-B069-2261900738F525 * section "Migrating an Existing Java Applet"26 */27 -->28 22 29 23 <!-- JNLP File for GLI applet --> … … 44 38 <jar href="SignedGatherer.jar"/> 45 39 </resources> 46 <!--<application-desc main-class="org.greenstone.gatherer.WebGatherer"/>--> 47 <applet-desc main-class="org.greenstone.gatherer.WebGatherer" name="GLIapplet" height="50" width="380"> 40 <application-desc main-class="org.greenstone.gatherer.WebGatherer"> 41 <argument>-gwcgi=/greenstone3</argument> 42 <argument>-gsdl3=true</argument> 43 </application-desc> 44 <!-- 45 <applet-desc main-class="org.greenstone.gatherer.GathererApplet" name="GLIapplet" height="50" width="380"> 48 46 <param name="gwcgi" value="/greenstone3" /> 49 47 <param name="gsdl3" value="true" /> 50 48 </applet> 49 --> 51 50 <!-- https://stackoverflow.com/questions/12600076/getting-user-home-folder-from-jws-signed-jar --> 52 51 <security> -
main/trunk/gli/README_WebGLI.txt
r32138 r32139 43 43 https://docs.oracle.com/javase/9/whatsnew/toc.htm 44 44 https://docs.oracle.com/javase/9/deploy/migrating-java-applets-jnlp.htm 45 section "Migrating an Existing Java Applet" 45 46 https://docs.oracle.com/javase/9/deploy/self-contained-application-packaging.htm 46 47 http://www.oracle.com/technetwork/java/javase/migratingfromapplets-2872444.pdf … … 65 66 https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#JARManifest 66 67 https://community.oracle.com/thread/1536875?start=0 68 69 https://stackoverflow.com/questions/1199211/java-webstart-with-parameters 70 https://stackoverflow.com/questions/14116640/how-to-use-jnlp-to-pass-command-line-arguments-to-the-application -
main/trunk/gli/src/org/greenstone/gatherer/WebGatherer.java
r32138 r32139 28 28 package org.greenstone.gatherer; 29 29 30 import java.applet.*;31 30 import java.awt.event.ActionEvent; 32 31 import java.awt.event.ActionListener; … … 35 34 36 35 import java.io.*; 36 //import javax.jnlp.*; 37 37 import javax.swing.*; 38 38 import org.greenstone.gatherer.util.JarTools; … … 40 40 import org.greenstone.gatherer.util.Utility; 41 41 42 43 public class WebGatherer extends JApplet implements ActionListener 42 import java.util.*; 43 44 public class WebGatherer 44 45 { 45 private Gatherer gatherer = null; 46 47 48 protected String fullLibraryURL(String address) 46 47 protected static String fullLibraryURL(String address) 49 48 { 50 49 String full_address = ""; … … 55 54 full_address = address; 56 55 } 57 else if (address.startsWith("/")) {56 /*else if (address.startsWith("/")) { 58 57 // there is not protocol and host 59 URL document = getDocumentBase(); 58 // JNLP replacement for applet getDocumentBase, https://stackoverflow.com/questions/6371493/java-web-start-getdocumentbase 59 BasicService bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService"); 60 URL document = bs.getCodeBase(); 60 61 int port_no = document.getPort(); 61 62 62 63 String port = (port_no>0) ? ":" + port_no : ""; 63 64 full_address = "http://" + document.getHost() + port + address; 64 } 65 }*/ 65 66 66 67 return full_address; 67 68 } 68 69 69 70 /* This is the entry point for the GLI applet */ 71 public void init() 70 static private String getParameter(String cmd_arg, String flagName) { 71 int start_index = cmd_arg.indexOf(flagName) + flagName.length(); 72 cmd_arg = cmd_arg.substring(start_index); 73 return cmd_arg; 74 } 75 76 /* This is the entry point for the Java Web Start version of GLI (a rewrite of GathererApplet as a Java Web Start application) */ 77 static public void main(String cmdArgs[]) 72 78 { 73 JarTools.initialise(this); 79 Gatherer gatherer = null; 80 JarTools.initialise(WebGatherer.class); 81 82 String gwcgi_arg = null; 83 String gsdl3_arg = "false"; // String, "true" or "false" 84 String windowsHome_arg = null; 85 String debug_arg = "false"; // String, "true" or "false" 86 87 for(int i = 0; i<cmdArgs.length; i++) { 88 ///System.err.println("*** cmdarg " + i + " = " + cmdArgs[i]); 89 90 if(cmdArgs[i].contains("gwcgi=")) { 91 gwcgi_arg = getParameter(cmdArgs[i], "gwcgi="); 92 } else if(cmdArgs[i].contains("gsdl3=")) { 93 gsdl3_arg = getParameter(cmdArgs[i], "gsdl3="); 94 } else if(cmdArgs[i].contains("windowsHome=")) { 95 windowsHome_arg = getParameter(cmdArgs[i], "windowsHome="); 96 } else if(cmdArgs[i].contains("debug=")) { 97 debug_arg = getParameter(cmdArgs[i], "debug="); 98 } 99 } 100 101 ///System.err.println("*** gwcgi_arg = " + gwcgi_arg); 102 ///System.err.println("*** gsdl3_arg = " + gsdl3_arg); 103 // More debugging: 104 Map<String,String> envMap = System.getenv(); 105 Set<Map.Entry<String,String>> entries = envMap.entrySet(); 106 Iterator<Map.Entry<String, String>> i = entries.iterator(); 107 System.err.println("*** ENVIRONMENT: "); 108 while(i.hasNext()) { 109 Map.Entry<String, String> entry = i.next(); 110 String key = entry.getKey(); 111 String value = entry.getValue(); 112 System.err.println("*** key = " + key); 113 System.err.println("*** val = " + value); 114 } 115 // End debugging 74 116 75 117 // Check if the user has agreed to the requested security settings … … 81 123 } 82 124 catch (Exception exception) { 83 getContentPane().add(new JLabel("Greenstone Librarian Interface Applet deactivated", JLabel.CENTER));125 System.err.println("Greenstone Librarian Interface Applet deactivated"); 84 126 return; 85 127 } … … 97 139 String gli_user_directory_path = System.getProperty("user.home") + File.separator; 98 140 if (Utility.isWindows()) { 99 String windows_home_parameter = getParameter("windowsHome");141 String windows_home_parameter = windowsHome_arg; 100 142 if (windows_home_parameter != null && !windows_home_parameter.equals("")) { 101 143 gli_user_directory_path = windows_home_parameter + File.separator + "GLI" + File.separator; … … 114 156 115 157 // Set some global variables so we know how we're running 116 Gatherer.isApplet = true;117 String library_url_string = fullLibraryURL(g etParameter("gwcgi"));118 119 String gs3 = g etParameter("gsdl3");158 Gatherer.isApplet = false; 159 String library_url_string = fullLibraryURL(gwcgi_arg); 160 161 String gs3 = gsdl3_arg; 120 162 boolean isGS3 = (gs3 == null || !gs3.equals("true")) ? false : true; 121 163 … … 127 169 } 128 170 129 // String debug_param = getParameter("debug");171 // String debug_param = debug_arg; 130 172 // if ((debug_param != null) && (debug_param.matches("true"))) { 131 173 // go.debug = true; … … 183 225 184 226 185 public void start()186 {187 System.err.println("Start called");188 }189 190 191 public void stop()192 {193 System.err.println("Stop called");194 }195 196 197 public void destroy()198 {199 System.err.println("Destroy called");200 gatherer.exit();201 gatherer = null;202 System.err.println("Done gatherer exit.");203 }204 205 206 public void actionPerformed(ActionEvent e)207 {208 gatherer.openGUI();209 }210 211 212 227 /** 213 228 * Method which unzips a given metadata resource. -
main/trunk/gli/src/org/greenstone/gatherer/util/JarTools.java
r12105 r32139 42 42 43 43 static public void initialise(Object root_object) 44 { 45 initialise(root_object.getClass()); 46 } 47 48 static public void initialise(Class rootClass) 44 49 { 45 root_class = root _object.getClass();50 root_class = rootClass; 46 51 ERROR_ICON = getImage("error.gif"); 47 52 }
Note:
See TracChangeset
for help on using the changeset viewer.