import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.URLConnection;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.AbstractMap;
import jalview.bin.Console;
import jalview.util.ChannelProperties;
import jalview.util.HttpUtils;
+import jalview.util.UserAgent;
public class Plausible
{
// random clientId to make User-Agent unique (to register analytic)
clientId = String.format("%08x", new Random().nextInt());
- USER_AGENT = HttpUtils.getUserAgent(
+ USER_AGENT = UserAgent.getUserAgent(
MethodHandles.lookup().lookupClass().getCanonicalName() + " "
+ clientId);
}
try
{
URL url = new URL(urlSb.toString());
- URLConnection urlConnection = url.openConnection();
- HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;
+ HttpURLConnection httpURLConnection = (HttpURLConnection) HttpUtils
+ .openConnection(url);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
try
{
URL url = new URL(CONFIG_API_BASE_URL);
- URLConnection urlConnection = url.openConnection();
- HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;
+ HttpURLConnection httpURLConnection = (HttpURLConnection) HttpUtils
+ .openConnection(url);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setRequestProperty("User-Agent", USER_AGENT);
httpURLConnection.setConnectTimeout(5000);