protected OutputStream flushHeaders(Message outMessage) throws IOException {
updateResponseHeaders(outMessage);
Object responseObj = outMessage.get(HTTP_RESPONSE);
OutputStream responseStream = null;
if (responseObj instanceof HttpResponse) {
HttpResponse response = (HttpResponse)responseObj;
Integer i = (Integer)outMessage.get(Message.RESPONSE_CODE);
if (i != null) {
int status = i.intValue();
if (status == HttpURLConnection.HTTP_INTERNAL_ERROR) {
response.setStatus(status, "Fault Occurred");
} else if (status == HttpURLConnection.HTTP_ACCEPTED) {
response.setStatus(status, "Accepted");
} else {
response.setStatus(status);
}
} else {
response.setStatus(HttpURLConnection.HTTP_OK);
}
copyResponseHeaders(outMessage, response);
responseStream = response.getOutputStream();
if (isOneWay(outMessage)) {
response.commit();
}
} else if (null != responseObj) {
String m = (new org.apache.cxf.common.i18n.Message("UNEXPECTED_RESPONSE_TYPE_MSG",
LOG, responseObj.getClass())).toString();
LOG.log(Level.WARNING, m);