"Chunked transfer encoding not allowed for " +
message.getHttpVersion());
}
return new ChunkedOutputStream(datatransmitter);
} else if (HTTP.IDENTITY_CODING.equalsIgnoreCase(s)) {
return new IdentityOutputStream(datatransmitter);
} else {
throw new ProtocolException(
"Unsupported transfer encoding: " + s);
}
} else if (contentLengthHeader != null) {
String s = contentLengthHeader.getValue();
try {
long len = Long.parseLong(s);
return new ContentLengthOutputStream(datatransmitter, len);
} catch (NumberFormatException e) {
throw new ProtocolException("Invalid content length: " + s);
}
} else {
return new IdentityOutputStream(datatransmitter);
}
}