public void newChunk(int i, byte[] data) {
IoBuffer bb = IoBuffer.wrap(data);
session.write(bb);
}
};
ChunkingOutputStream out = new ChunkingOutputStream(store, 1024);
try {
m.getResource().writeTo(out);
out.flush();
} catch (Exception e) {
log.error("exception sending message", e);
} finally {
close(out);
}