if (contentLen != null) {
contentLenValue = Integer.parseInt(contentLen);
if (contentLenValue > 0) {
FastCharArrayWriter fastCharArrayWriter = new FastCharArrayWriter(contentLenValue);
try {
StreamUtil.copy(reader, fastCharArrayWriter, contentLenValue);
} catch (IOException ioex) {
throw new HttpException(ioex);
}
bodyString = fastCharArrayWriter.toString();
}
}
// chunked encoding
String transferEncoding = header("Transfer-Encoding");
if (transferEncoding != null && transferEncoding.equalsIgnoreCase("chunked")) {
FastCharArrayWriter fastCharArrayWriter = new FastCharArrayWriter();
try {
while (true) {
String line = reader.readLine();
int len = Integer.parseInt(line, 16);
if (len > 0) {
StreamUtil.copy(reader, fastCharArrayWriter, len);
reader.readLine();
} else {
// end reached, read trailing headers, if there is any
readHeaders(reader);
break;
}
}
} catch (IOException ioex) {
throw new HttpException(ioex);
}
bodyString = fastCharArrayWriter.toString();
}
// no body yet - special case
if (bodyString == null && contentLenValue != 0) {
// body ends when stream closes
FastCharArrayWriter fastCharArrayWriter = new FastCharArrayWriter();
try {
StreamUtil.copy(reader, fastCharArrayWriter);
} catch (IOException ioex) {
throw new HttpException(ioex);
}
bodyString = fastCharArrayWriter.toString();
}
// BODY READY - PARSE BODY
String charset = this.charset;
if (charset == null) {