On Wed, 2006-11-01 at 12:22 +0100, [EMAIL PROTECTED] wrote:
> Hello,
> 
> I am new in network programming.
> 
> 
> The following example shows, how I handle the inputstream
> with HttpClient.
> 
> //********************************************************
> 
> //...
>         client = new HttpClient();
>         
>         initHttpsProtocol();
>         initHost();
> 
>         GetMethod  method = new GetMethod(SERVERURL);
>         
>         try {
>             int statusCode = client.executeMethod(method);
> 
> //          ...  exception handling
> 
>             // I am looking for the opposite
>             InputStream in = method.getResponseBodyAsStream();
>             DataInputStream dataIn = new DataInputStream(in);
>             String test = dataIn.readUTF();
>             
>              // make a flush ...
>              // close and handle the response
> 
> ...
> //********************************************************
> 
> I am looking for the opposite.
> 
> How can the client make an outpustream and send data to
> the server ?
> 

Bastian,

Use one of the RequestEntity implementations shipped with HttpClient or
implement a custom one.

http://svn.apache.org/repos/asf/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/methods/RequestEntity.java

You can take this piece of code as a starting point if you end up
needing a custom RequestEntity

http://svn.apache.org/repos/asf/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/methods/FileRequestEntity.java

Oleg

> 
> The data I want to transport are some :
> 
>     'Strings' to control the workflow and
>     'files'   (context-type : application/octet-stream)
> 
> 
> I found nothing about OutpuStreams, only something like :
> 
>     method.setQueryString(NameValuePair[] arg0);
> 
> Probably I am on the wrong way,
> 
> thanks for help,
> 
> Bastian


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to