JavaでHTTP Request

JavaでHTTP Requestを投げる方法は以下のとおり.

HttpURLConnectionクラスを使う

URL url = new URL("http://www.hogehoge.com")
HttpURLConnection connection = (HttpURLConnection)url.connection();

connection.setMethod("POST"); //POST GETなど
connection.connect();