if (request instanceof HttpEntityEnclosingRequest) {
HttpEntity incoming = ((HttpEntityEnclosingRequest) request).getEntity();
byte[] data = EntityUtils.toByteArray(incoming);
ByteArrayEntity outgoing = new ByteArrayEntity(data);
outgoing.setChunked(true);
response.setEntity(new NHttpEntityWrapper(outgoing));
} else {
StringEntity outgoing = new StringEntity("No content");
response.setEntity(new NHttpEntityWrapper(outgoing));
}
}
};