* mappings of the corresponding input message (if any).
*
* @param message the message to be sent.
*/
public void send(Message message) throws IOException {
Response response = (Response)request.get(Response.class);
// 1. handle response code
Integer i = (Integer)message.get(Message.RESPONSE_CODE);
if (i != null) {
response.setStatusCode(i.intValue());
}
// 2. handle response headers
updateResponseHeaders(message);
Map<String, List<String>> protocolHeaders =
(Map<String, List<String>>)message.get(Message.PROTOCOL_HEADERS);
// set headers of the HTTP response object
Iterator headers = protocolHeaders.entrySet().iterator();
while(headers.hasNext()) {
Map.Entry entry = (Map.Entry)headers.next();
String headerName = (String)entry.getKey();
String headerValue = getHeaderValue((List)entry.getValue());
response.setHeader(headerName, headerValue);
}
//TODO gregw says this should work: current cxf-jetty code wraps output stream.
//if this doesn't work, we'd see an error from jetty saying you cant write headers to the output stream.
message.setContent(OutputStream.class, response.getOutputStream());
}