Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39399
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: cross post. How do I get the http POST body? |
| Date | 2020-03-17 10:05 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <r4qlft$1fag$1@gioia.aioe.org> (permalink) |
| References | <16110cea-bf84-4823-ae22-adf692a1f499@googlegroups.com> <r4o525$av0$1@gioia.aioe.org> <c62ad26e-4dad-4ba9-b3ba-0f3cc2f06287@googlegroups.com> |
On 3/17/2020 7:52 AM, C.D. Altenburg, Ph.D, wrote: > On Monday, March 16, 2020 at 8:13:22 AM UTC-7, Arne Vajhøj wrote: >> On 3/16/2020 10:47 AM, C.D. Altenburg, Ph.D, wrote: >>> The question is how do I get the post body in Java. Ie, the http body has the following format >> The basic usage of HttpURLConnection. >> >> Most people prefer to use Apache HttpClient (or if you are at >> Java 11 then the new builtin HttpClient). >> >> But all the above seems a bit mixed up. >> >> It seem like: >> * you want to call a web service and get some JSON data back >> * you actually call a login page >> >> What do you want to do? >> > I just want to call a web service and get some JSON data back. And I don't use HttpClient because it's not supported on the Java platform that I use. Apache HttpClient is just a jar file - it should work on any Java compliant platform. If you are developing for Android it may be a bit messier - Android ship with an old version of Apache HttpClient, but you can add a special Android version of newer version if you need to. But HttpUrlConnection should also be able to do the job. You set method to POST you write request body to getOutputStream() and you read response body from getInputStream(). Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cross post. How do I get the http POST body? "C.D. Altenburg, Ph.D," <cdalten@gmail.com> - 2020-03-16 07:47 -0700
Re: cross post. How do I get the http POST body? Arne Vajhøj <arne@vajhoej.dk> - 2020-03-16 11:13 -0400
Re: cross post. How do I get the http POST body? "C.D. Altenburg, Ph.D," <cdalten@gmail.com> - 2020-03-17 04:52 -0700
Re: cross post. How do I get the http POST body? Arne Vajhøj <arne@vajhoej.dk> - 2020-03-17 10:05 -0400
Re: cross post. How do I get the http POST body? Joerg Meier <joergmmeier@arcor.de> - 2020-03-17 15:11 +0100
csiph-web