Я пытаюсь сделать POST с HttpURLConnection
(мне нужно использовать его таким образом, не могу использовать HttpPost
), и я хотел бы добавить параметры для этого подключения, такие как
post.setEntity(new UrlEncodedFormEntity(nvp));
где
nvp = new ArrayList<NameValuePair>();
имея некоторые данные, хранящиеся в. Я не могу найти способ, как добавить этот ArrayList
в мой HttpURLConnection
который находится здесь:
HttpsURLConnection https = (HttpsURLConnection) url.openConnection();
https.setHostnameVerifier(DO_NOT_VERIFY);
http = https;
http.setRequestMethod("POST");
http.setDoInput(true);
http.setDoOutput(true);
Причиной такого неудобного сочетания https и http является необходимость не проверять сертификат. Это не проблема, однако, он хорошо размещает сервер. Но мне нужно, чтобы пост с аргументами.
Есть идеи?
Дубликат Отказ от ответственности:
Еще в 2012 году я понятия не имел, как параметры были вставлены в запрос HTTP POST. Я NameValuePair
за NameValuePair
потому что это было в учебнике. Этот вопрос может показаться, как дубликат, однако, мои 2012 самостоятельно прочитать, что другой вопрос, и он не использует NameValuePair
. На самом деле это не решило мою проблему.