Dear Roland,

>> Otherwise, when I use StringEntity or ByteArrayEntity to wrap the string
>> and put it into HttpEntity (by HttpPost.setEntity()), the server can't get
>> the string use request.getReader() nor request.getInputStream().

> What _do_ you get at the server via Reader/InputStream?
I get "null" via Reader/InputStream.

> What is the Content-Type header you are sending? 
I set the content-type to "text/plain" or " text/plain; charset=UTF-8."

> Do you try to get parameters from the request before reading?
No, I get parameters after reading.

Here are part codes of the client side and server side I used for experimenting.

---- client code ----
// ... lots of construction 
StringEntity stringEntity = new StringEntity(login, HTTP.UTF_8);    // login is 
an xml content
stringEntity.setContentType(" text/plain; charset=UTF-8");
httpPost.setEntity(stringEntity);
httpclient.execute(httpPost);

---- server code ----
// ... lots of construction
//build reader to read input buffer
BufferedReader reader = request.getReader();
StringBuffer buffer = new StringBuffer();
                        
int c ;
while( (c = reader.read()) != -1){
        buffer.append( (char)c );
}
reader.close();

System.out.println("receive: " + buffer.toString());
----

The buffer.toString() is null.

Is there any suggestion for experimenting?

Sincerely,
Micky


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


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

Reply via email to