StringRepresentation rep = new StringRepresentation("0123456789");
try {
DigesterRepresentation digester = new DigesterRepresentation(rep);
// Such representation computes the digest while
// consuming the wrapped representation.
digester.exhaust();
// Set the digest with the computed one
digester.setDigest(digester.computeDigest());
request.setEntity(digester);
Response response = client.handle(request);