// If the request entity is repeatable, we can send it first to
// our own stream, so we can return it
final HttpEntity entityEntry = entity.getEntity();
if(entityEntry.isRepeatable()) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
entityEntry.writeTo(bos);
bos.flush();
// We get the posted bytes using the charset that was used to create them
entityBody.append(new String(bos.toByteArray(), charset));
bos.close();
}