是的Htt presponse字符串? [英] Is HttpResponse String?

查看:203
本文介绍了是的Htt presponse字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我回答以下问题:

<一个href=\"http://stackoverflow.com/questions/6939122/not-getting-response-response-httpclient-executerequest\">not得到响应响应= httpclient.execute(请求);

请参阅我的回答there.Then我从我的回答评论
 Peterdk

See my answer there.Then I got a comment on my answer from Peterdk

为:

的响应不是HTP presponse而是一个字符串。或者,你怎么得到它
  是一个Htt的presponse?这是否取决于ResponseHandler所?

The response is not a HtppResponse but a String. Or how do you get it to be a HttpResponse? Does this depend on the ResponseHandler?

现在我有一个疑问,是的Htt presponse一个String?

Now i have a doubt "Is HttpResponse a String ?"

请帮我清楚我的这种怀疑和解释我什么是错在我的概念。

Please help me clear my this doubt and explain me what was wrong in my concept.

推荐答案

你的答案的评论是毫无意义我的全部。我不知道为什么你下投了票,但实际上我不认为这个问题的措词不够好,在正确地回答你,但如果你怀疑真的有这样的事情,你可以通过检查逻辑思考过它该文档。

简短的回答:

Htt的presponse不是一个字符串。

HttpResponse is not a String.

龙答:

的<一个href=\"http://developer.android.com/reference/org/apache/http/client/HttpClient.html#execute%28org.apache.http.client.methods.HttpUriRequest%29\"相对=nofollow>为 HttpClient.execute文档(串)显示了该方法签名:

The documentation for HttpClient.execute(string) shows this as the method signature:

public abstract HttpResponse execute (HttpUriRequest request)

所以很明显执行返回一个的Htt presponse

现在>为的Htt presponse 你发现的Htt presponse 是一个接口,包括方法,如你在你的答案的方法: getStatusLine()。你马上知道,接口没有一个字符串,所以的Htt presponse 不是字符串,但如果你可能会认为这是另一种方式,也许字符串工具的Htt presponse ,它应该是相当显然,字符串没有所谓的一个方法 getStatusLine(),它会是荒谬的东西作为一般作为字符串来实现一个接口做HTTP。如果你的真正的要肯定,你可以查看文档再次看到字符串没有 getStatusLine()并没有实现接口的Htt presponse

Now if you go to the docs for HttpResponse you find that HttpResponse is an interface and includes methods such as the method you used in your answer: getStatusLine(). Immediately you know that an interface isn't a String, so HttpResponse isn't a String, but in case you might think it's the other way and maybe String implements HttpResponse, it should be fairly obvious that String doesn't have a method called getStatusLine() and that it'd be ridiculous for something as generic as a String to implement an interface to do with HTTP. If you really want to be sure, you can check the docs again and see that String doesn't have getStatusLine() and doesn't implement the interface HttpResponse.

这篇关于是的Htt presponse字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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