Hi Roland,
Actually I once used the following code to set it:
ServletInputStream sis= request.getInputStream();
int len=request.getContentLength();
String conten_type=request.getContentType();
httppost.setRequestContentLength(len);
httppost.setRequestHeader("Content-type",content_type);
InputStreamRequestEntity re= new
InputStreamRequestEntity(sis);
httppost.setRequestEntity(re);
But it still did not work. (Later I thought the content-type should be by
default "'application/x-www-form-urlencoded", so you didn't see it in my
post, but even it is there it still doesn't work)
Thanks,
Han
Roland Weber wrote:
>
> Hello Han,
>
>>_ webpage="http://m168.com/test_servlet";
>>_ HttpClient client = new HttpClient();
>>_ PostMethod httppost = new PostMethod(webpage);
>>_
>>_ ServletInputStream sis= request.getInputStream(); ///these 2 line
can
>>_be replaced by set RequestEntity***
>>_ httppost.setRequestBody(sis); // *** ****************************
>>_
>>_ client.executeMethod(httppost);
>
>
> Where do you set the Content-Type header for the
> request you are sending? Without that header, the
> target servlet can't know that you are sending
> parameters.
> Sorry for sending you off on the wrong trail.
>
> cheers,
> Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/postmethod-does-not-work-tf4719655.html#a13511884
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]