diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-11 12:41:14 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-11 12:41:14 +0100 |
commit | a88ef239b58ba926f9ce29e2b87d636fae18aaf4 (patch) | |
tree | 4a3babc4bcd6be96ace77516ade9f83660f1deda /jsonrpc/src/main/java/com | |
parent | 52088a08a9edb6d4b60e1e8923e1b3199db9f391 (diff) |
Add HttpUtil which sends HTTP requests.
Diffstat (limited to 'jsonrpc/src/main/java/com')
-rw-r--r-- | jsonrpc/src/main/java/com/orbekk/net/HttpUtil.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/jsonrpc/src/main/java/com/orbekk/net/HttpUtil.java b/jsonrpc/src/main/java/com/orbekk/net/HttpUtil.java new file mode 100644 index 0000000..b4bb887 --- /dev/null +++ b/jsonrpc/src/main/java/com/orbekk/net/HttpUtil.java @@ -0,0 +1,26 @@ +package com.orbekk.net; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HttpUtil { + private static final Logger logger = + LoggerFactory.getLogger(HttpUtil.class); + + public static void sendHttpRequest(String url) { + try { + URL pingUrl = new URL(url); + pingUrl.openStream(); + // URLConnection connection = pingUrl.openConnection(); + // connection.connect(); + } catch (MalformedURLException e) { + logger.warn("Unable to send ping to {}: {}.", url, e); + } catch (IOException e) { + logger.warn("Error when sending ping: {}", e); + } + } +} |