Changeset 19543
- Timestamp:
- 2009-05-20T17:59:26+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/server/Server2.java
r19470 r19543 23 23 { 24 24 private static final int WAITING_TIME = 10; // time to wait and check for whether the server is running 25 private static final String URL_PENDING="URL_pending"; 25 26 26 27 protected String libraryURL; … … 100 101 + PortFinder.PORTS_RESERVED + " - " + PortFinder.MAX_PORT + "]" ); 101 102 quitPort = -1; 103 } 104 } 105 106 // If the GSI is set to NOT autoenter/autostart the server, then write url=URL_PENDING out to the file. 107 // When the user finally presses the Enter Library button and so has started up the server, the correct 108 // url will be written out to the configfile. 109 if(config_properties.getProperty(BaseServer.Property.AUTOSTART, "").equals("0")) {//if(configfile.endsWith("llssite.cfg")) { 110 if(config_properties.getProperty("url") == null) { 111 config_properties.setProperty("url", URL_PENDING); 112 ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 113 ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 114 scriptReadWrite.replaceOrAddLine(fileLines, "url", URL_PENDING, true); 115 scriptReadWrite.writeOutFile(config_properties_file, fileLines); 102 116 } 103 117 } … … 250 264 ScriptReadWrite scriptReadWrite = new ScriptReadWrite(); 251 265 ArrayList fileLines = scriptReadWrite.readInFile(BaseServer.config_properties_file); 252 if (fileLines.contains("url="+getBrowserURL())) { 253 // would be last element, remove it: 254 fileLines.remove(fileLines.size()-1); 266 267 // Remove the url=... line, start searching from the end 268 boolean done = false; 269 for (int i = fileLines.size()-1; i >= 0 && !done; i--) { 270 String line = ((String) fileLines.get(i)).trim(); 271 if(line.startsWith("url=")) { 272 fileLines.remove(i); 273 done = true; 274 } 255 275 } 256 276 scriptReadWrite.writeOutFile(config_properties_file, fileLines); … … 273 293 // 1. Test that the server is running at the libraryURL before writing it out to glisite.cfg/configfile 274 294 // A quick test involves opening a connection to get the home page for this collection 275 if(libURL != null ) {295 if(libURL != null && !libraryURL.equals(URL_PENDING)) { 276 296 277 297 boolean ready = false;
Note:
See TracChangeset
for help on using the changeset viewer.