本文介绍了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?

推荐答案


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

10-28 03:41