Skip to content

Instantly share code, notes, and snippets.

@dotanh
Created May 17, 2012 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dotanh/2717520 to your computer and use it in GitHub Desktop.
Save dotanh/2717520 to your computer and use it in GitHub Desktop.
RESTful client example using Apache Jersey: GET call
String serverBootResponse =
service.path("machine/createMachine")
.queryParam("name", serverName)
.queryParam("imageId", imageId)
.accept(MediaType.APPLICATION_XML)
.cookie(cookie)
.get(String.class);
final DocumentBuilder documentBuilder = createDocumentBuilder();
final Document doc =
documentBuilder.parse(new InputSource(new StringReader(serverBootResponse)));
final String status = xpath.evaluate("response/responseCode", doc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment