hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chaitanya Ravi" <r.chaita...@gmail.com>
Subject Re: Warning message?
Date Tue, 21 Mar 2006 09:53:40 GMT
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 <r.chaitanya@gmail.com> 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 <station@cbn.net.id> 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: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> >
> >
>


--
Chaitanya Ravi,
e-Trust, CA,ITC
E-Mail: chaitanya.ravi@ca.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message