Re: client side api.

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 UTC