Ignore:
Timestamp:
2009-09-17T16:24:39+12:00 (15 years ago)
Author:
ak19
Message:
  1. Changes to get localhost to be recognised on Linux and the hostname to be recognised on Windows. Multiple allowed host values are inserted into the configfile (e.g. llssite.cfg) and these are used in httpd.conf. 2. Fixed errors: the Address Resolution Method part of the GSI dialog should not be deactivated when the Allow External Connections is checked.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/server/Server2Settings.java

    r20604 r20618  
    1313import org.greenstone.server.BaseServerSettings;
    1414
    15 public class Server2Settings extends BaseServerSettings implements ActionListener
     15public class Server2Settings extends BaseServerSettings
    1616{
    1717    protected JComboBox prefix_combobox;
     
    4141    allowConnections = new JCheckBox(server.dictionary.get(BaseServer.Property.SERVER_SETTINGS+".ExternalAccess"), allowCons);
    4242    allowConnections.setBackground(bg_color);
    43     allowConnections.addActionListener(this);
    4443   
    4544    JPanel connect_panel = new JPanel(new GridLayout(4, 1));
    4645    connect_panel.setBackground(bg_color);
    47     connect_panel.setBorder(BorderFactory.createTitledBorder("Connection configuration"));
     46    connect_panel.setBorder(BorderFactory.createTitledBorder(server.dictionary.get(BaseServer.Property.SERVER_SETTINGS+".AddressResolutionMethod")));
    4847
    4948    hostRadioButtons = new JRadioButton[4];
     
    5857        hostGroup.add(hostRadioButtons[i]);
    5958        hostRadioButtons[i].setBackground(bg_color);
    60         hostRadioButtons[i].setEnabled(!allowCons);
    61     }
    62    
     59    }   
    6360
    6461    String addressResolutionMethod = server.config_properties.getProperty("address_resolution_method").trim();
     
    114111   
    115112    // work out the host (default is address_resolution_method 2: localhost)
    116     String host = "localhost";
     113    String hosts = "127.0.0.1 localhost";
     114    String fixedHostIP = "127.0.0.1";
    117115    InetAddress inetAddress = null;
    118116    try {
    119117        inetAddress = InetAddress.getLocalHost();
     118
     119        fixedHostIP = inetAddress.getHostAddress(); // used for all cases unless things go wrong
     120        hosts = "127.0.0.1 " + fixedHostIP;         // for address_resolution_methods 1 and 3
     121
     122        if(address_resolution_method == 2) {
     123        hosts = hosts + " localhost";
     124        } else if(address_resolution_method == 0) {
     125        hosts = hosts + " " + inetAddress.getHostName() + " localhost";
     126        }
    120127    } catch(UnknownHostException e) {
    121128        logger.error(e);
    122         logger.info("Server2.java reload(): Defaulting host IP to "+ host); // use the default     
     129        logger.info("Server2.java reload(): Defaulting host IP to localhost");
     130        fixedHostIP = "127.0.0.1";
    123131        address_resolution_method = 2;
     132        hosts = "127.0.0.1 localhost";
    124133    }
    125     switch(address_resolution_method) {
    126     case 0:
    127         host = inetAddress.getHostName();
    128         break;
    129     case 1:
    130         host = inetAddress.getHostAddress();
    131         break;
    132     case 3:
    133         host = "127.0.0.1";
    134         break;
    135     case 2: default:
    136         host = "localhost";         
    137     }
    138     newFileLines = scriptReadWrite.queryReplace(newFileLines, "host", host);
     134
     135    newFileLines = scriptReadWrite.queryReplace(newFileLines, "hosts", hosts);
     136    newFileLines = scriptReadWrite.queryReplace(newFileLines, "hostIP", fixedHostIP);
    139137
    140138    // address resolution method - onSave() would have updated
     
    142140    newFileLines = scriptReadWrite.queryReplace(newFileLines, "address_resolution_method", Integer.toString(address_resolution_method));
    143141   
    144     }
    145 
    146     public void actionPerformed(ActionEvent e) {
    147     boolean toggle = !allowConnections.isSelected();
    148     if(e.getSource() == allowConnections) {
    149         for(int i = 0; i < hostRadioButtons.length; i++) {
    150         hostRadioButtons[i].setEnabled(toggle);
    151         }
    152     }
    153     }
    154 
     142    }   
    155143}
Note: See TracChangeset for help on using the changeset viewer.