So I am trying to use HttpClient to read from a remote txt file in my companies network. There are no firewalls or anything blocking my request. Here is my code:
try{
CloseableHttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet("file://hostname/facility_data/Facility_Extract.txt");
HttpResponse response = client.execute(request);
HttpEntity entity = response.getEntity();
BufferedReader in = new BufferedReader((new InputStreamReader(entity.getContent())));
String input;
while ((input = in.readLine()) != null) {
LOG.info(input);
}
in.close();
}catch(Exception e){
LOG.error("Could not access files : "+e.getMessage());
}
I think it has something to do with the 'file://' protocol but i am not sure how I would adjust to accommodate that. Any ideas?