Article View: borland.public.jbuilder.java.language
Article #14417How do I send parameters via doPost from java?
From: Jason Dore
Date: Tue, 07 Sep 1999 00:00
Date: Tue, 07 Sep 1999 00:00
30 lines
1662 bytes
1662 bytes
Hi
I cant find any reference in the Java documentation to the mechanism I need
to use to open a 'POST' style URLConnection to a web server and pass
parameters as if they were coming from a web form.
I currently do the following:
URL myURL = new URL( "..." );
HttpURLConnection myHttp = (HttpURLConnection) myURL.openConnection();
myHttp.setRequestMethod("POST")
myHttp.setRequestProperty("myParameter","myValue")
myHttp.connect();
InputStream myStream = myHttp.getInputStream();
I can confirm that this does to a http hit on my web server, and it is a
POST and not a GET, but I do not get any parameters set when I look at them
in the webserver. Calling the webserver from a webpage works fine.
I'm currently using jbuilder3 and jdk1.2.
Anyone know how to do this? Is setRequestProperty a red herring? How do I
pass these parameters?
Thanks in advance
Jason Dore
--
Purple Thinking
UK.
Technical Details
Message-ID:
<936710431.2510.0.nnrp-03.9e984195@news.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,59447e8c14221473,start X-Google-Attributes: gidf74b3,public X-Google-Thread: 10a146,59447e8c14221473,start X-Google-Attributes: gid10a146,public From: "Jason Dore" <jase@purplethinking.com> Subject: How do I send parameters via doPost from java? Date: 1999/09/07 Message-ID: <936710431.2510.0.nnrp-03.9e984195@news.demon.co.uk> X-Deja-AN: 522083876 X-NNTP-Posting-Host: nedlog.demon.co.uk:158.152.65.149 X-Trace: news.demon.co.uk 936710431 nnrp-03:2510 NO-IDENT nedlog.demon.co.uk:158.152.65.149 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.language,comp.lang.java.programmer X-Complaints-To: abuse@demon.net