- Timestamp:
- 2009-09-17T16:24:39+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/server/Server2.java
r20604 r20618 8 8 import java.io.InputStreamReader; 9 9 import java.io.IOException; 10 import java.net.InetAddress; 10 11 import java.net.ServerSocket; 11 12 import java.net.Socket; 13 import java.net.UnknownHostException; 12 14 import java.net.URL; 13 15 //import java.net.URLConnection; … … 207 209 //reloadConfigProperties(); 208 210 port = config_properties.getProperty("portnumber", port); 209 host = config_properties.getProperty("host", host); 210 211 212 // The "hosts" property in the config file contains more than one allowed host 213 // Need to work out the particular host chosen from the address_resolution_method 214 // Default is address_resolution_method 2: localhost 215 String addressResolutionMethod = config_properties.getProperty("address_resolution_method"); 216 int address_resolution_method = (addressResolutionMethod == null) ? 2 : Integer.parseInt(addressResolutionMethod); 217 InetAddress inetAddress = null; 218 try { 219 inetAddress = InetAddress.getLocalHost(); 220 } catch(UnknownHostException e) { 221 logger_.error(e); 222 logger_.info("Defaulting host IP to "+ host); // use the default 223 address_resolution_method = 2; 224 } 225 switch(address_resolution_method) { 226 case 0: 227 host = inetAddress.getHostName(); 228 break; 229 case 1: 230 host = inetAddress.getHostAddress(); 231 break; 232 case 2: 233 host = "localhost"; 234 break; 235 case 3: 236 host = "127.0.0.1"; 237 break; 238 default: 239 host = "localhost"; 240 } 211 241 } catch(Exception e) { 212 242 recordError("Exception trying to load properties from gsdlsite_cfg. Using default library prefix.", e);
Note:
See TracChangeset
for help on using the changeset viewer.