Java HTTP Response Code getResponseCode(String urlS)

Here you can find the source of getResponseCode(String urlS)

Description

get Response Code

License

Open Source License

Declaration

public static int getResponseCode(String urlS)
            throws java.net.MalformedURLException, java.io.IOException, java.net.ProtocolException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.URL;
import java.net.HttpURLConnection;

public class Main {
    public static int getResponseCode(String urlS)
            throws java.net.MalformedURLException, java.io.IOException, java.net.ProtocolException {
        URL url = new URL(urlS);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("GET");
        return connection.getResponseCode();
    }// w ww  .ja v a 2  s. c  o  m
}

Related

  1. getResponseCode(String URL)
  2. getResponseCode(String urlString)
  3. getResponseCode(String urlString)
  4. getResponseCode(String urlString)
  5. getResponseCode(URL url)