http请求的响应出现问题 [英] A problem in response of http request

查看:111
本文介绍了http请求的响应出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过在Blackberry中发送http请求来接收响应.它正确打开了Http连接器.但是它无法收到响应.下面提到了我用来接收响应的代码.

I try to receive a response from sending a http request in blackberry. It correctly open the Http Connector. But It can''t receive the response. The code I used yo recieve the response is mentioned below.

String url="https://www.google.lk/";
HttpConnection con = null;
InputStream is = null;

try {
    con = (HttpConnection) Connector.open(url);
    int responseCode = con.getResponseCode();
    Dialog.alert(String.valueOf(responseCode ));
   }
catch(Exception e)
{
	Dialog.alert(e.getMessage());
}



该代码未如预期的那样显示警告.在Blackberry Simulator上运行应用程序时,也不会发生任何异常.上面的代码有任何错误吗?



The code is not shown a alert as expected in the code. And also any exception is not occurred while running the application on Blackberry simulator. Is any error in above code?

推荐答案

不是专家,但这是blackberry网站上的文档
http://docs.blackberry.com/en/developers/deliverables/11938/CS_create_first_available_HTTP_connection_857706_11.jsp [ ^ ]
Not an expert but here is a document from blackberry website
http://docs.blackberry.com/en/developers/deliverables/11938/CS_create_first_available_HTTP_connection_857706_11.jsp[^]


这篇关于http请求的响应出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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