主机名可能无法在Android的零误差 [英] host name may not be null error in android

查看:84
本文介绍了主机名可能无法在Android的零误差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到的错误主机名称不能为空的错误在我的Andr​​oid应用程序。

I get the error "host name may not be null error " in my Android app.

这是我的code:

DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httpost = new HttpPost("http://sub_domain.domain.com/service/api");
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
ResponseHandler responseHandler = new BasicResponseHandler();
    try {
        httpclient.execute(httpost, responseHandler);
    } catch (ClientProtocolException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

我用的子域名,所以我不能把'WWW'在我的网址,因为它的另一个子域。 我在我的清单文件上网权限。

I use a sub-domain so I can't put 'www' in my url because it's another sub domain. I have Internet permission in my manifest file.

有什么建议?谢谢!

编辑:这是不可能用GET方法访问这个网址

Edit : It's impossible to access to this url with a GET method.

如果没有'_'在我的子域,也没关系。

Without '_' in my subdomain, it's okay.

推荐答案

你看这个链接。 Apache的犯规支持下划线

Look this link. Apache doesnt support underscore

https://issues.apache.org/jira/browse/HTTPCLIENT-911

这篇关于主机名可能无法在Android的零误差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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