简体   繁体   English

正在读取被Android切断的Content标头?

[英]Reading Content headers being cut off by android?

I am making a call to an API, the API returns fine in C# for another application but in Android for our APP it is cutting off after the 5534 character, for smaller sets of data it returns fine but after this it gets cutt off.. the string looks something like this: 我正在调用一个API,该API在C#中为另一个应用程序返回正常,但在Android中对于我们的APP,它在5534个字符之后中断,对于较小的数据集,它返回正常,但在此之后被中断。字符串看起来像这样:

response.getFirstHeader("X-JSON").getValue() is returning this response.getFirstHeader("X-JSON").getValue()返回此

[{"Customer":"","Name":"Fred","MI":"","ContactType":"Person","Id":8909,"IsDeleted":false,"TotalClients":0},...."MANY MORE HERE"...
 ...{"Customer":"","Name":"Test Name","MI":"B","ContactType":"Person","Id"

I get all the lines fine up to the last one as you can see it cutts off by "Id". 我得到的所有行都可以精确到最后一行,因为您可以看到它被“ Id”切断。 When I try with a smaller set, by calling the API to a smaller account, its fine.. it never gets cutt off and I obtain the expected results, on the other hand for this big account with a lot of data it just doesnt get everything.. 当我尝试使用较小的集合时,通过将API调用到较小的帐户,它很好..它永远不会中断,并且我可以获得预期的结果,另一方面,对于具有大量数据的这个大帐户,它只是不会得到一切..

Any idea of what could be the issue? 知道可能是什么问题吗?

Related Code below: 相关代码如下:

        DefaultHttpClient client = HttpSingleton.getThreadSafeClient();
        HttpGet get = new HttpGet(URL);
        get.setHeader("Accept", "application/json");
        HttpResponse response = client.execute(get);
        get.abort();
        printHeaders(response);             
        responseString = response.getFirstHeader("X-JSON").getValue();

Are you passing data as an HTTP header? 您是否将数据作为HTTP标头传递? There is a limit on the size of data you can pass in an HTTP header.. See this: 您可以在HTTP标头中传递的数据大小受到限制。请参见:

Maximum on http header values? http标头值的最大值?

Why not pass data in response body as usually? 为什么不像往常一样在响应正文中传递数据?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM