following is my code, like
HttpGet httpReq = new HttpGet(uri);
HttpParams httpParameters = new BasicHttpParams();
// Set the timeout in milliseconds until a connection is
established.
int timeoutConnection = 3000;
HttpConnectionParams.setConnectionTimeout(httpParameters,
timeoutConnection);
// Set the default socket timeout (SO_TIMEOUT)
// in milliseconds which is the timeout for waiting for data.
int timeoutSocket = 3000;
HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
DefaultHttpClient httpClient = new
DefaultHttpClient(httpParameters);
HttpResponse httpRes = httpClient.execute(httpReq);
if(httpRes.getStatusLine().getStatusCode() == 200) {
String strRet =
EntityUtils.toString(httpRes.getEntity()); //
StringIndexOutOfBoundsException
...................
..............
2011/6/26 a a <[email protected]>:
> I tested at morning, it will cause
>
> java.lang.StringIndexOutOfBoundsException
>
> if the http response is too long, so what i can get all from http response?
>
> 2011/6/26 NaveenShrivastva <[email protected]>:
>> Please use
>>
>> String reversePalindrome = new String(server response);
>>
>>
>>
>>
>> On Sun, Jun 26, 2011 at 1:19 PM, JAlexoid (Aleksandr Panzin)
>> <[email protected]> wrote:
>>>
>>> If the response is not Text/HTML/JSON/XML/(other text based) then use
>>> a byte array.
>>>
>>> On Jun 26, 4:12 am, a a <[email protected]> wrote:
>>> > HI, all:
>>> >
>>> > I want to get the content to sting Variable from uri var
>>> > HttpResponse.
>>> >
>>> > Is there any litimation for the long of sting variable ? may be the
>>> > http response will very very long.... sting variable is correct to
>>> > hold all ?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>
>>
>> --
>> Naveen Shrivastava
>> BCA+MCA(LAST SEM)+O/A/B Level(DOEACC SOCITY IT GOVT INDIA)
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en