getAbs方法注意事项
- 参数 url 绝对路径必须包含 protocol(http, https 等), 否则会因为非法 url 抛出 crash
client
.getAbs("https://myserver.mycompany.com:4043/some-uri")
.send()
.onSuccess(res ->
System.out.println("Received response with status code" + res.statusCode()))
.onFailure(err ->
System.out.println("Something went wrong " + err.getMessage()));
get()方法的参数注意事项
-
host 参数:必须不能包含 protocol,否则会出现 Unable to resolve host 异常。
-
reletiveUrl :必须是 / 开头,内部不会自动拼接,否则会出现400 Bad Request 异常。
client
.get(443, "myserver.mycompany.com", "/some-uri")
.ssl(true)
.send()
.onSuccess(res ->
System.out.println("Received response with status code" + res.statusCode()))
.onFailure(err ->
System.out.println("Something went wrong " + err.getMessage()));
网友评论