title: JAVA List / Read directory from url
body: <p>I have a URL which can be accessed from  the server, It has a Lot of XML, logs files which get updated on a regular basis and hence I need to keep tap for the user to see </p>
  
  <p>Is is possible that I can get the names of those files and possibly even display the content in a view for the user to see?</p>
  
  <p>I tries this but it didnt work at all.</p>
  
  <p>note I cant access the machine any other way, just the URL</p>
  
  <pre><code> String path = request.getContextPath();
  path += DOWNLOADS;
  URL url = null;
  String server = request.getServerName();
  try {
      url = new URL("https", server, request.getLocalPort(), path);
  } catch (MalformedURLException e) {
      e.printStackTrace();
  }
  if (url != null) {
      String externalForm = url.toExternalForm();
      File directory = new File(externalForm);
      String[] files = directory.list();
      for (String file : files) {
          ;
      }
  }
  </code></pre>
  
  <p>Thanks</p>