HttpClient的Andr​​oid上:通过UMTS NoHtt presponseException / 3G [英] HttpClient on Android : NoHttpResponseException through UMTS/3G

查看:109
本文介绍了HttpClient的Andr​​oid上:通过UMTS NoHtt presponseException / 3G的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的Andr​​oid应用程序,使用的HttpClient来达到我的servlet 部署在我的Tomcat。它安装在我的HTC Magic。

I have got my android app that uses HttpClient to reach my servlet deployed on my Tomcat. It is installed on my HTC Magic.

如果我启动它接在无线的时候:它的工作原理。 如果我启动它,当连接到3G(GSM数据网络):这是行不通的,但我的servlet为止。换句话说,似乎我的电话从来没有得到响应:

If I launch it when connected on Wifi : it works. If I launch it when connected to 3G (GSM data network) : it doesn't work but my servlet is reached. In other word, it seems that my phone never get the response :

Technical problem while receiving response.
org.apache.http.NoHttpResponseException: The target server failed to respond
   at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:85)
   at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
   at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
   at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235)
   at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
   at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
   at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
   at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:410)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)

如果我用通过3G网络浏览器来激活打包在我的servlet测试HTML页面,到达同一个servlet成功(页面收到响应)。

If I use the web browser through 3G to activate the test HTML page that is packaged with my servlet, it reaches the same servlet with success (the page receives the response).

我怎么能调试的HttpClient或要求其抛售的一切吗?

How could I debug HttpClient or ask it to dump everything ?

是否有人有什么回事线索?

Does someone have a clue on what's going on ?

推荐答案

我终于摆脱了这个问题:一个简单的HTTP标头竟被由鱿鱼服务器处理的道路上:

I finally got rid of this problem : simply a HTTP header that was badly handled by a squid server on the road :

期待:100继续

这似乎在默认情况下与DefaultHttpClient在Android SDK在那里。为了解决这个问题,只需添加在您的code:

It seems to be there by default with DefaultHttpClient on android SDK. To tackle this, simply add that in your code :

  HttpProtocolParams.setUseExpectContinue(httpClient.getParams(), false);

这篇关于HttpClient的Andr​​oid上:通过UMTS NoHtt presponseException / 3G的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆