title: How to obtain the date of a file which was read through URL connection?
body: <p>I would like to know how can I obtain the date of a (XML) file which was read through an URL connection. I am storing this file in a database and I want to update it if the file has changed. For this reason I would like to obtain its date.</p>
  
  <p>Currently I have implemented the code that obtains and parses the file:</p>
  
  <pre><code>private PolicyDocument getPolicyFileFromURI(String policyURI){
      //get the QoD-policy document using the URI
      URL url;
      PolicyDocument policy = null;
  
      try {
          url = new URL(policyURI);
          URLConnection conn = url.openConnection();
  
          try {
              XmlOptions options = new XmlOptions();
              policy = PolicyDocument.Factory.parse(conn.getInputStream());
          } catch (Exception e) {
              throw new ContextException("Couldn't read qod-policy document at location " + policyURI, e);
          }           
      } catch (MalformedURLException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (IOException e) {
          e.printStackTrace();
      }
  
      return policy;
  }
  </code></pre>
  
  <p>Thanks!</p>