code: static HttpResponse executeHeadRequest(URI uri, SerializationFormat format) throws IOException {
  
          HttpHead headMethod = new HttpHead(uri);
          MyRedirectHandler redirectHandler = new MyRedirectHandler(uri);
  
          String acceptHeader = format.getMimeType() != null && ! format.getMimeType().trim().isEmpty() ? format.getMimeType() : "*/*";
          CloseableHttpClient httpClient = HttpClientBuilder
              .create()
              .setDefaultRequestConfig(requestConfig)
              .setConnectionManager(poolingConnManager)
              .setSSLContext(ssl)
              .setRedirectStrategy(redirectHandler)
              .setDefaultHeaders(Arrays.asList(
                  new BasicHeader("Accept", acceptHeader), //if default request we try to pretend to be a browser, else we accept everything
                  new BasicHeader("User-Agent", "Mozilla/5.0"),
                  new BasicHeader("Upgrade-Insecure-Requests", "1")       // we are an all trusting client...
              ))
              .build();
  
          HttpResponse httpResponse = httpClient.execute(headMethod);
          redirectHandler.lastRedirectedUri.forEach(x -> httpResponse.setHeader(HEADERKEY, String.valueOf(x)));
          return httpResponse;
      }
docs: Will execute a HEAD only request, following redirects, trying to locate an rdf document.
  @param uri - the initial uri
  @param format - the expected mime type
  @return - the final http response
  @throws IOException