Hi Chaitanya,
Thank you for the answer, it work great.
What is the benefit reading responsebody using stream instead of string?

Best Regards,

Ricky

At 03:23 PM 3/21/2006 +0530, you wrote:
Hi Ricky,

But the warning message suggest you to use getResponseBodyAsStream.

Replace reply = method.getResponseBody() with below lines:

            InputStream is = postMethod.getResponseBodyAsStream();
            BufferedInputStream bis = new BufferedInputStream( is );

            String datastr = null;
            StringBuffer sb = new StringBuffer();
            byte[] bytes = new byte[ 8192 ]; // reading as chunk of 8192
bytes
            int count = bis.read( bytes );
            while( count != -1 && count <= 8192 )
            {
                datastr = getString(bytes, count);
                sb.append(datastr);
                count = bis.read( bytes );
            }

           bis.close();
           reply = sb.toString();

This is the correct way to read response when expecting large response data.

Regards,

On 3/21/06, Chaitanya Ravi <[EMAIL PROTECTED]> wrote:
>
> Hi Ricky,
>
> You can kill them by including these 3 lines in your class constructor
>
> System.setProperty("org.apache.commons.logging.Log", "
> org.apache.commons.logging.impl.SimpleLog");
> System.setProperty ("org.apache.commons.logging.simplelog.showdatetime",
> "true");
>       System.setProperty("
> org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
> "error");
>
>
>
> Regards
> Chaitanya
>
>
>
> On 3/21/06, Ricky <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> > How do I remove warning message from console?
> >
> > Mar 21, 2006 1:41:11 PM org.apache.commons.httpclient.HttpMethodBase
> > getResponseBody
> > WARNING: Going to buffer response body of large or unknown size. Using
> > getResponseBodyAsStream instead is recommended.
> >
> > Thanks,
> >
> > Ricky
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


--
Chaitanya Ravi,
e-Trust, CA,ITC
E-Mail: [EMAIL PROTECTED]


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

Reply via email to