On Thu, 2008-03-13 at 13:10 +0100, Thorsten Scherler wrote:
> Hi all,
>
> I am ATM trying to integrate latest httpclient into Droids. I have some
> "old" code that is based on a prior version of the client.
>
> Some method/class name changes I found myself but some I am not sure how
> to implement them.
>
> When my old code was:
> PostMethod filePost = new PostMethod(solrBase);
> filePost.addRequestHeader("Content-type", "text/xml; charset=utf-8");
> filePost.addRequestHeader("User-Agent", AGENT);
> filePost.setRequestBody(new URL(srcUrl).openStream());
>
> Now I do:
> HttpPost filePost = null;
> filePost = new HttpPost(solrBase);
> filePost.addHeader("Content-type", "text/xml; charset=utf-8");
> filePost.addHeader("User-Agent", AGENT);
> InputStreamEntity reqEntity = new InputStreamEntity(src, -1);
> filePost.setEntity(reqEntity);
>
> But for the following I could not found the corresponding method:
> public String getResponseCharSet() {
> return filePost.getResponseCharSet();
> }
>
> public String getResponseBodyAsString() {
> return filePost.getResponseBodyAsString();
> }
>
> Can you point me to the new methods?
>
Hi Thorsten,
These methods are now provided by the EntityUtils class
http://hc.apache.org/httpcomponents-core/httpcore/apidocs/org/apache/http/util/EntityUtils.html
Generally I would recommend avoiding consuming response entities as
strings in the real life application unless you are absolutely sure they
are of reasonable / limited length.
Oleg
> TIA
>
> salu2
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]