org.apache.http.ProtocolException: Target host is not specified

来源:互联网 发布:地热模拟软件 编辑:程序博客网 时间:2024/04/30 08:25

对于httpClient4.3访问指定页面,可以从下面的demo抽取方法使用。

注意:对于URL必须使用 http://开始,否则会有如下报错信息:

Caused by: org.apache.http.ProtocolException: Target host is not specified
    at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.Java:69)
    at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183)
    ... 5 more

2 0
原创粉丝点击