Java URL Value Check isResponsive(URL url)

Here you can find the source of isResponsive(URL url)

Description

is Responsive

License

LGPL

Declaration

public static boolean isResponsive(URL url) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.io.IOException;
import java.net.*;

public class Main {
    public static boolean isResponsive(URL url) {
        try {/*from  ww w .  j av a  2s  .co m*/
            HttpURLConnection httpConnection = (HttpURLConnection) url.openConnection();
            httpConnection.setRequestMethod("HEAD");
            httpConnection.setConnectTimeout(1000);
            httpConnection.setReadTimeout(1000);
            return httpConnection.getResponseCode() == 200;
        } catch (IOException ioe) {
            return false;
        }
    }
}

Related

  1. isLocalURL(String s)
  2. isLocalURL(URL url)
  3. isLocalURL(URL url)
  4. isNewer(URL file, URL reference)
  5. isResponseCode(String url, int expectedCode)
  6. isSameFile(URL u, File out)
  7. isURL(final String urlString)
  8. isURL(Object obj)
  9. isUrl(String input)