Changeset 29845
- Timestamp:
- 2015-04-21T20:30:46+12:00 (9 years ago)
- Location:
- main/trunk/greenstone3
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/build.properties.in
r28643 r29845 30 30 # default servlet to start with 31 31 server.default.servlet=/library 32 # whether to make the greenstone pages publicly accessible or only to this machine 33 server.external.access=true 32 34 33 35 # The context name of your GS3 digital library. By default this will be "greenstone3". -
main/trunk/greenstone3/build.xml
r29711 r29845 123 123 <condition property="privileged.attribute" value="privileged='true'" else=""> 124 124 <equals arg1="7" arg2="${tomcat.version.major}"/> 125 </condition> 126 127 <!-- external access to the GS3 pages or not 128 https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html --> 129 <condition property="allowed.IPs" 130 value=".*" 131 else="(127\.0\.0\.1|::1|0:0:0:0:0:0:0:1)"> 132 <matches pattern="^(1|true|yes)$" string="${server.external.access}"/> 125 133 </condition> 126 134 … … 1342 1350 <filter token="gsdl3webhome" value="${web.home}"/> 1343 1351 <filter token="gsdl3webwritablehome" value="${web.writablehome}"/> 1344 <filter token="privilegedattribute" value ="${privileged.attribute}"/> 1352 <filter token="privilegedattribute" value="${privileged.attribute}"/> 1353 <filter token="allowedIPs" value="${allowed.IPs}"/> 1345 1354 </filterset> 1346 1355 </copy> -
main/trunk/greenstone3/resources/java/server.properties
r24480 r29845 2 2 Server2Settings.Port=Apache port: 3 3 Server2Settings.URL=Library URL prefix: 4 Server2Settings.ExternalAccess=Allow external connections5 4 Server2Settings.AddressResolutionMethod=Address resolution method 6 5 Server2Settings.ResolveIP=Get local IP and resolve to a name … … 27 26 ServerSettings.SettingChanged=The new settings will be available when you press Enter Library/Restart Library. 28 27 ServerSettings.SettingsUnchangedPortOccupied=Unable to run the Greenstone server on port {0}. It appears to already be in use. 28 ServerSettings.ExternalAccess=Allow external connections 29 29 30 30 ServerControl.EnterLibrary=Enter Library -
main/trunk/greenstone3/resources/tomcat/greenstone3.xml.in
r29722 r29845 25 25 file. --> 26 26 <Manager pathname="SESSIONS.ser" /> 27 28 <!-- Allow all machines or just this machine: 127.0.0.1 (IPv4) and 0:0:0:0:0:0:0:1 (IPv6, needed on windows) 29 https://tomcat.apache.org/tomcat-7.0-doc/config/valve.html --> 30 <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="@allowedIPs@"/> 27 31 </Context> -
main/trunk/greenstone3/src/java/org/greenstone/server/BaseProperty.java
r24207 r29845 8 8 public final String KEEPPORT; 9 9 public final String START_BROWSER; 10 public final String ALLOW_EXTERNAL_ACCESS; 10 11 11 12 public final String DEFAULT_SERVLET = "server.default.servlet"; … … 22 23 public final String SERVER_SETTINGS; 23 24 24 protected BaseProperty(String version, String web_port, String autostart, String startbrowser, String keepport) 25 protected BaseProperty(String version, 26 String web_port, 27 String autostart, 28 String startbrowser, 29 String keepport, 30 String allowExternalAccess) 25 31 { 26 32 // property names … … 33 39 START_BROWSER = startbrowser; 34 40 KEEPPORT = keepport; 41 ALLOW_EXTERNAL_ACCESS = allowExternalAccess; 35 42 } 36 43 -
main/trunk/greenstone3/src/java/org/greenstone/server/BaseServerSettings.java
r25635 r29845 22 22 protected JCheckBox autoEnter; 23 23 protected JCheckBox keepPortToggle; 24 protected JCheckBox allowConnections; 24 25 25 26 protected JSpinner portNumber_spinner = null; … … 35 36 protected String browserPath = ""; 36 37 protected boolean useDefaultBrowser = true; 38 protected boolean externalaccess = false; 37 39 38 40 protected JDialog self; … … 102 104 keepPortToggle.setBackground(bg_color); 103 105 106 boolean allowCons = false; 107 String externalAccessStr = server.config_properties.getProperty(BaseServer.Property.ALLOW_EXTERNAL_ACCESS, "1").trim(); 108 allowConnections = new JCheckBox(server.dictionary.get("ServerSettings.ExternalAccess"), allowCons); 109 if(externalAccessStr.equals("1") || externalAccessStr.equals("true")) { 110 this.externalaccess = true; 111 allowCons = true; 112 allowConnections.setSelected(true); 113 } else { 114 allowConnections.setSelected(false); 115 } 116 117 allowConnections.setBackground(bg_color); 104 118 105 119 JButton save_button = new JButton(BaseServer.dictionary.get("ServerSettings.OK")); … … 125 139 port_panel.setBackground(bg_color); 126 140 127 JPanel top_panel = new JPanel(new GridLayout( 3,1));141 JPanel top_panel = new JPanel(new GridLayout(4,1)); 128 142 top_panel.add(port_panel); 129 143 top_panel.add(keepPortToggle); 130 144 top_panel.add(autoEnter); 145 top_panel.add(allowConnections); 131 146 132 147 JPanel comb_panel = createServletPanel(); … … 252 267 } 253 268 269 boolean oldExternalAccess = externalaccess; 270 externalaccess = allowConnections.isSelected() ? true : false; 271 if (oldExternalAccess != externalaccess) { 272 has_changed = true; 273 require_restart = true; 274 server.reconfigRequired(); 275 } // else require_restart remains what it had been 254 276 255 277 // call subclass' onSave method, which may indicate (further) changes, … … 287 309 288 310 // call the subclass' save() method to save custom elements 311 // and to save externalAccess in a custom manner for both GS2 and GS3 289 312 save(scriptReadWrite, newFileLines); 290 313 -
main/trunk/greenstone3/src/java/org/greenstone/server/Server2Property.java
r24465 r29845 9 9 // Initialising customised final variables 10 10 // Version number, WEB_PORT 11 super("2", "portnumber", property_prefix+"autoenter", property_prefix+"start_browser", "keepport"); 11 super("2", "portnumber", property_prefix+"autoenter", property_prefix+"start_browser", 12 "keepport", "externalaccess"); 12 13 } 13 14 -
main/trunk/greenstone3/src/java/org/greenstone/server/Server2Settings.java
r29843 r29845 17 17 { 18 18 protected JComboBox prefix_combobox; 19 protected JCheckBox allowConnections;20 19 protected JRadioButton[] hostRadioButtons = new JRadioButton[4]; 21 20 22 21 // 0 to 3: 0 is resolved (hostname) from local IP, 1 is local IP address, 2 is localhost, 3 is 127.0.0.1 23 22 protected int address_resolution_method = 2; 24 protected int externalaccess = 0;25 23 26 24 public Server2Settings(BaseServer server) … … 33 31 JPanel server2panel = new JPanel(); 34 32 server2panel.setLayout(new BorderLayout()); 35 36 boolean allowCons = false;37 String externalAccess = server.config_properties.getProperty("externalaccess", "").trim();38 if(!externalAccess.equals("") && externalAccess.equals("1")) {39 this.externalaccess = 1;40 allowCons = true;41 }42 allowConnections = new JCheckBox(server.dictionary.get(BaseServer.Property.SERVER_SETTINGS+".ExternalAccess"), allowCons);43 allowConnections.setBackground(bg_color);44 33 45 34 JPanel connect_panel = new JPanel(new GridLayout(4, 1)); … … 67 56 68 57 JPanel comb_panel = new JPanel(new BorderLayout()); 69 comb_panel.add(allowConnections, BorderLayout.NORTH);70 58 comb_panel.add(connect_panel, BorderLayout.CENTER); 71 59 return comb_panel; … … 75 63 { 76 64 // superclass detects changes to port and autoenter 77 // handle changes to address_resolution_method and externalAccess/allowConnectionshere65 // handle changes to address_resolution_method here 78 66 79 67 boolean hasChanged = false; … … 87 75 server.reconfigRequired(); 88 76 } 89 }90 91 int oldExternalAccess = externalaccess;92 externalaccess = allowConnections.isSelected() ? 1 : 0;93 if (oldExternalAccess != externalaccess) {94 hasChanged = true;95 requireRestart = true;96 server.reconfigRequired();97 77 } 98 78 … … 116 96 117 97 // external access - onSave() would have updated this value 118 newFileLines = scriptReadWrite.queryReplace(newFileLines, "externalaccess", Integer.toString(externalaccess)); 98 // Its possible values are specific to the version of Greenstone: 0 or 1 for GS2 (true or false for GS3) 99 newFileLines = scriptReadWrite.queryReplace(newFileLines, BaseServer.Property.ALLOW_EXTERNAL_ACCESS, externalaccess ? "1" : "0"); 119 100 120 101 // work out the host (default is address_resolution_method 2: localhost) -
main/trunk/greenstone3/src/java/org/greenstone/server/Server3Property.java
r24207 r29845 10 10 // Version number, WEB_PORT, autoenter, startbrowser 11 11 // For GS3, the last two are controlled by the same property 12 super("3", "tomcat.port", "server.auto.start", "server.auto.start", "server.keep.port"); 12 super("3", "tomcat.port", "server.auto.start", "server.auto.start", 13 "server.keep.port", "server.external.access"); 13 14 } 14 15 -
main/trunk/greenstone3/src/java/org/greenstone/server/Server3Settings.java
r29728 r29845 105 105 String newKeepPort = (new Boolean(keepPortToggle.isSelected())).toString(); 106 106 newFileLines = scriptReadWrite.queryReplace(newFileLines, BaseServer.Property.KEEPPORT, newKeepPort); 107 108 // external access - BaseServerSettings.actionPerformed() would have updated this value 109 // Its possible values are specific to the version of Greenstone: 0 or 1 for GS2 (true or false for GS3) 110 newFileLines = scriptReadWrite.queryReplace(newFileLines, BaseServer.Property.ALLOW_EXTERNAL_ACCESS, externalaccess ? "true" : "false"); 107 111 108 112 String newServletDef = (String) servlet_combobox.getSelectedItem();
Note:
See TracChangeset
for help on using the changeset viewer.