我已经尝试了这两种方法:
builder.scheme("http").authority("10.0.2.2:28642").appendPath("api").appendPath("DeliveryItems").appendPath("PostArgsAndXMLFileAsStr").
builder.scheme("http").authority("10.0.2.2:28642/api").appendPath("DeliveryItems").appendPath("PostArgsAndXMLFileAsStr").
尽管由于其他原因,代码还没有工作,但我想知道哪种方式是正确的:
.authority("10.0.2.2:28642").appendPath("api").
-或:
authority("10.0.2.2:28642/api").
URI的"authority"部分标识谁负责指定路径部分的语义。这通常是主机/端口的组合,并且可以选择性地包括用户名/密码(如http://user:pass@host:port/somepage
)。
维基百科有更多关于URI语法的详细信息。