final SmxHttpExchange httpExchange) throws Exception {
httpExchange.setURL(getLocationUri(exchange, inMsg));
// Temporary fix for bug in jetty-client 6.1.5
// http://fisheye.codehaus.org/browse/jetty-contrib/jetty/trunk/contrib/client/src/main/java/org/mortbay/jetty/client/HttpConnection.java?r1=374&r2=378
httpExchange.addRequestHeader(HttpHeaders.HOST_BUFFER, new ByteArrayBuffer(new URI(getLocationUri(exchange, inMsg)).getHost()));
httpExchange.setMethod(getMethod(exchange, inMsg));
httpExchange.setRequestHeader(HttpHeaders.CONTENT_TYPE, getContentType(exchange, inMsg));
if (getHeaders() != null) {
for (Map.Entry<String, String> e : getHeaders().entrySet()) {
httpExchange.setRequestHeader(e.getKey(), e.getValue());
}
}
if (inMsg.getContent() != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
transformer.toResult(inMsg.getContent(), new StreamResult(baos));
httpExchange.setRequestContent(new ByteArrayBuffer(baos.toByteArray()));
}
}