}
public Response sendMessage(Method method, PrivilegeResource resource, String id)
throws IOException
{
XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType);
String privId = (method == Method.POST) ? "" : "/" + id;
String serviceURI = "service/local/privileges" + privId;
if (method == Method.POST) {
serviceURI += "_target";
}
if (method == Method.POST || method == Method.PUT) // adding put so we can check for the 405, without a
// resource you get a 400
{
PrivilegeResourceRequest requestResponse = new PrivilegeResourceRequest();
requestResponse.setData(resource);
// now set the payload
representation.setPayload(requestResponse);
log.debug(method.getName() + ": " + representation.getText());
}
return RequestFacade.sendMessage(serviceURI, method, representation);
}