try {
//Wrap the input stream
try ( MaxLengthByteArrayOutputStream teedOut = new MaxLengthByteArrayOutputStream(); TeeInputStream teeInputStream = new TeeInputStream( entityInputStream, teedOut ) ) {
UniqueId uniqueId = deserialize( teeInputStream );
return new ActionResponse( uniqueId, response.getStatus(), response.getLocation(), teedOut.toByteArray() );
}
} catch ( IOException e ) {
throw new RuntimeException( e );
}
}