Changeset 32430
- Timestamp:
- 2018-09-06T22:34:17+12:00 (5 years ago)
- Location:
- gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java
r32419 r32430 96 96 Properties globalProperties = new Properties(); 97 97 globalProperties.load(Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream("global.properties")); 98 99 /* 98 100 String host = globalProperties.getProperty("tomcat.server", "localhost"); 99 101 //String port = globalProperties.getProperty("tomcat.port.http", "8383"); … … 107 109 String portStr = port.equals("80") ? "" : ":"+port; 108 110 solr_servlet_base_url = protocol+"://"+host+portStr+"/"+solrContext; 111 */ 112 113 // The solr servlet is only accessible locally (from "localhost", specifically 127.0.0.1). 114 // for security reasons, as we don't want non librarian users 115 // to go to the solr servlet and delete solr cores or something. 116 // The security Valve element in the tomcat solr.xml context file restricts 117 // access to 127.0.0.1, but here we ensure that the solr URL is the local http one 118 // and not any https with domain name and https port. 119 // Note that we use 127.0.0.1 instead of literally "localhost" since localhost is unsafe 120 ProtocolPortProperties protocolPortProps = new ProtocolPortProperties(globalProperties); // can throw Exception 121 String solrContext = globalProperties.getProperty("solr.context", "solr"); 122 solr_servlet_base_url = protocolPortProps.getLocalHttpBaseAddress()+"/"+solrContext; 123 109 124 } catch(Exception e) { 110 125 logger.error("Error reading greenstone's tomcat solr server properties from global.properties", e); -
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/SolrSearch.java
r32419 r32430 46 46 Properties globalProperties = new Properties(); 47 47 globalProperties.load(Class.forName("org.greenstone.util.GlobalProperties").getClassLoader().getResourceAsStream("global.properties")); 48 49 /* 48 50 String host = globalProperties.getProperty("tomcat.server", "localhost"); 49 51 //String port = globalProperties.getProperty("tomcat.port.http", "8383"); … … 56 58 String portStr = port.equals("80") ? "" : ":"+port; 57 59 solr_servlet_base_url = protocol+"://"+host+portStr+"/"+solrContext; 60 */ 61 62 // The solr servlet is only accessible locally (from "localhost", specifically 127.0.0.1). 63 // for security reasons, as we don't want non librarian users 64 // to go to the solr servlet and delete solr cores or something. 65 // The security Valve element in the tomcat solr.xml context file restricts 66 // access to 127.0.0.1, but here we ensure that the solr URL is the local http one 67 // and not any https with domain name and https port. 68 // Note that we use 127.0.0.1 instead of literally "localhost" since localhost is unsafe 69 ProtocolPortProperties protocolPortProps = new ProtocolPortProperties(globalProperties); // can throw an Exception 70 String solrContext = globalProperties.getProperty("solr.context", "solr"); 71 solr_servlet_base_url = protocolPortProps.getLocalHttpBaseAddress()+"/"+solrContext; 58 72 } catch(Exception e) { 59 73 logger.error("Error reading greenstone's tomcat solr server properties from global.properties", e);
Note:
See TracChangeset
for help on using the changeset viewer.