W3C home > Mailing lists > Public > www-jigsaw@w3.org > July to August 1999

Re: client side api.

From: Yves Lafon <ylafon@w3.org>
Date: Thu, 5 Aug 1999 17:25:56 +0200 (MET DST)
To: Christophe Vigny <cvigny@netserveur.fr>
cc: www-jigsaw@w3.org
Message-ID: <Pine.GSO.4.10.9908051721480.20331-100000@tarantula.inria.fr>
On Thu, 5 Aug 1999, Christophe Vigny wrote:

> hello.
> 
> I'm dont understand why the Request.getOuptputStream is an InputStream.
> 
> to make some post methode we need an OutputStream to write the value off the
> parameters into the Request.
> 
> It's impossible because the getOutputStream return an InputStream.
> 
> Please tell me how to make some post with the client side api.

Well, if you want to do post, you have to give an inut stream to the
request. The request will read from that input stream and send it to the
remote server.
Ex:

        request.setMethod("POST");
        string body = java.net.URLEncoder.encode('your post data');
        request.setOutputStream(new StringBufferInputStream(body));

Of course, for i18n purposes, don't use StringBufferInputStream ;)
Regards,

      /\          - Yves Lafon - World Wide Web Consortium - 
  /\ /  \        Architecture Domain - Jigsaw Activity Leader
 /  \    \/\    
/    \   /  \   http://www.w3.org/People/Lafon - ylafon@w3.org    
Received on Thursday, 5 August 1999 11:26:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:32 GMT