我正在尝试使用路径变量访问Rest资源以访问不同的资源:
@Test
public void testGetDBs() throws IOException {
GooUrl url = new GooUrl(GOO_URL + "users/id1"); // This works
List<String> path = new LinkedList<String>();
path.add("users");
path.add("id1");
//url.setPathParts(path); // this does not work
HttpRequest request;
try {
request = requestFactory.buildGetRequest(url);
request.setMethod(HttpMethod.POST);
String result = request.execute().parseAsString();
System.out.println("Result = " + result);
} catch (Exception e) {
e.printStackTrace();
}
}
然而,我正在
java.net.MalformedURLException: For input string: "8888users"
当我做setPathParts