// Finish the request normally:
if (!bodySent) {
bodySent = true;
if (needsChunk) {
DataOutputStream dos = new DataOutputStream(os);
ChunkedOutputStream cos = new ChunkedOutputStream(dos);
request.emit(cos, Request.EMIT_BODY);
cos.flush();
cos.close(false);
request.emit(os,Request.EMIT_FOOTERS);
} else {
request.emit(os,
Request.EMIT_BODY|Request.EMIT_FOOTERS);
}