Как использовать java.net.URLConnection для запуска и обработки HTTP-запросовJAVA

Программисты JAVA общаются здесь
Гость
Как использовать java.net.URLConnection для запуска и обработки HTTP-запросов

Сообщение Гость »


Использование

Код: Выделить всё

java.net.URLConnection
is asked about pretty often here, and the Oracle tutorial is too concise about it.
That tutorial basically only shows how to fire a GET request and read the response. It doesn't explain anywhere how to use it to, among others, perform a POST request, set request headers, read response headers, deal with cookies, submit a HTML form, upload a file, etc.
So, how can I use

Код: Выделить всё

java.net.URLConnection
to fire and handle "advanced" HTTP requests?


Источник: https://stackoverflow.com/questions/279 ... p-requests

Вернуться в «JAVA»