code: public Document readDocument(String url) {
          try {
              URL theURL = new URL(url);
              URLConnection conn = connectWithRedirect(theURL);
              if (conn == null)
                  return null;
  
              ProvFormat format = null;
              String content_type = conn.getContentType();
  
              logger.debug("Content-type: " + content_type);
              if (content_type != null) {
                  // Need to trim optional parameters
                  // Content-Type: text/plain; charset=UTF-8
                  int end = content_type.indexOf(";");
                  if (end < 0) {
                      end = content_type.length();
                  }
                  String actual_content_type = content_type.substring(0, end)
                          .trim();
                  logger.debug("Found Content-type: " + actual_content_type);
                  // TODO: might be worth skipping if text/plain as that seems
                  // to be the
                  // default returned by unconfigured web servers
                  format = mimeTypeRevMap.get(actual_content_type);
              }
              logger.debug("Format after Content-type: " + format);
  
              if (format == null) {
                  format = getTypeForFile(theURL.toString());
              }
              logger.debug("Format after extension: " + format);
  
              InputStream content_stream = conn.getInputStream();
  
              return readDocument(content_stream, format,url);
          } catch (IOException e) {
              throw new InteropException(e);
          }
      }
docs: Reads a document from a URL. Uses the Content-type header field to determine the
  mime-type of the resource, and therefore the parser to read the document.
  @param url a URL
  @return a Document