}
}
}
public CurlRequest toCurlRequest() {
CurlRequest request = new CurlRequest(resourceUrl);
if (body != null) {
JaxbHelper jaxb = JaxbHelper.get(body.getClass());
String xml;
try {
xml = jaxb.marshal(body, false);
} catch (JAXBException e) {
throw new OpenstackException("Error serializing request body", e);
}
request.body = xml;
}
request.method = this.method;
if (this.contentType != null) {
request.getHeaders().put("Content-Type", this.contentType.toString());
}
if (this.acceptTypes != null) {
String accept = Joiner.on(",").join(this.acceptTypes);
request.getHeaders().put("Accept", accept);
}
for (Entry<String, String> entry : this.headers.entrySet()) {
request.getHeaders().put(entry.getKey(), entry.getValue());
}
return request;
}