Changeset 37413
- Timestamp:
- 2023-03-06T09:07:24+13:00 (3 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r37355 r37413 1249 1249 1250 1250 try { 1251 String full_context_url = null; 1252 1253 if (!isWebswing) { 1254 full_context_url = Configuration.library_url.toString(); 1255 } 1256 else { 1257 // In the case of WebSwing, we can use the internal (e.g. localhost) form 1258 // of GS3 configuration service request, meaning we don't need to provide 1259 // authentication credentials 1260 1261 /* **** !!!! */ 1262 /* Need to rewrite this to avoid having to load in the build.properties file every time */ 1263 1264 String local_context = "greenstone3"; // Default 1265 1266 File buildPropsFile = new File(Configuration.gsdl3_src_path + File.separator + "build.properties"); 1267 if (buildPropsFile.exists()) { 1268 Properties props = new Properties(); 1269 try { 1270 props.load(new FileInputStream(buildPropsFile)); 1271 local_context = props.getProperty("greenstone.context", local_context); 1272 1273 ProtocolPortProperties protocol_port_props = new ProtocolPortProperties(props); // can throw Exception 1274 1275 full_context_url= protocol_port_props.getLocalHttpBaseAddress() + "/" + local_context; 1276 } 1277 catch(Exception e) { 1278 DebugStream.println("Could not load build.properties file"); 1279 System.err.println("Could not load build.properties file"); 1280 } 1281 } 1282 1283 if (full_context_url == null) { 1284 System.err.println("Setting base configuration URL to Greenstone3 default:"); 1285 full_context_url = "http://localhost:8383/greenstone3/"; 1286 System.err.println(" " + full_context_url); 1287 } 1288 } 1289 1290 String library_servlet_name = Configuration.getServletPath(); 1291 1292 /* The above replaces the old way of doing this, which is just the single following line */ 1251 1293 // need to add the servlet name to the exec address 1252 String raw_url = Configuration.library_url.toString() + Configuration.getServletPath() + command; 1294 //String raw_url = Configuration.library_url.toString() + Configuration.getServletPath() + command; 1295 1296 String raw_url = full_context_url + library_servlet_name + command; 1297 1298 1253 1299 URL url = new URL(raw_url); 1254 1300 DebugStream.println("Action: " + raw_url); 1301 1255 1302 HttpURLConnection library_connection = (HttpURLConnection) url.openConnection(); 1256 1303 int response_code = library_connection.getResponseCode();
Note:
See TracChangeset
for help on using the changeset viewer.