Java Reference
In-Depth Information
client = Client.create(config);
webResource =
client.resource(BASE_URI).path(
"com.ensode.netbeansbook.jaxrs.customer");
}
public void remove(String id) throws UniformInterfaceException {
webResource.path(java.text.MessageFormat.format("{0}",
new Object[]{id})).delete();
}
public String countREST() throws UniformInterfaceException {
WebResource resource = webResource;
resource = resource.path("count");
return resource.accept(
javax.ws.rs.core.MediaType.TEXT_PLAIN).get(String.class);
}
public <T> T findAll_XML(Class<T> responseType)
throws UniformInterfaceException {
WebResource resource = webResource;
return resource.accept(
javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType);
}
public <T> T findAll_JSON(Class<T> responseType)
throws UniformInterfaceException {
WebResource resource = webResource;
return resource.accept(
javax.ws.rs.core.MediaType.APPLICATION_JSON).get(
responseType);
}
public void edit_XML(Object requestEntity)
throws UniformInterfaceException {
webResource.type(
javax.ws.rs.core.MediaType.APPLICATION_XML).
put(requestEntity);
}
public void edit_JSON(Object requestEntity)
throws UniformInterfaceException {
webResource.type(
javax.ws.rs.core.MediaType.APPLICATION_JSON).put(
requestEntity);
}
public void create_XML(Object requestEntity)
throws UniformInterfaceException {
webResource.type(
javax.ws.rs.core.MediaType.APPLICATION_XML).post(
requestEntity);
 
Search WWH ::




Custom Search