Java API Tutorial - Java HttpURLConnection HTTP_PARTIAL








Syntax

HttpURLConnection.HTTP_PARTIAL has the following syntax.

public static final int HTTP_PARTIAL

Example

In the following code shows how to use HttpURLConnection.HTTP_PARTIAL field.

/* ww w.  j a v a  2s. c o  m*/
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
  public static void main(String[] argv) throws Exception {
    HttpURLConnection.setFollowRedirects(false);
    HttpURLConnection con = (HttpURLConnection) new URL("http://www.google.coom").openConnection();
    con.setRequestMethod("HEAD");
    System.out.println(con.getResponseCode() == HttpURLConnection.HTTP_PARTIAL);
  }
}