Код: Выделить всё
Path path = Paths.get(apiUrl);
URI uri = path.toUri();
HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection();
Подробнее здесь: https://stackoverflow.com/questions/788 ... connection
Код: Выделить всё
Path path = Paths.get(apiUrl);
URI uri = path.toUri();
HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection();