public static WebResource createEntity(Client c, WebResource work, String type, String data) throws IOException {
WebResource entity = work.path(type);
try {
entity.post(data);
throw new IOException("Could not create " + type + " with data " + data);
}
catch (WebResourceException e2) {
return c.resource(e2.getResponse().getLocation());
}
}
|