> Since I produce the xml in memory, that's the way Marshal.marshal method 
> works, I could use the ByteArrayEntity using the byte[] from the 
> ByteArrayOutputStream supplied to marshal.


Could you not do something like 

PipedOutputStream out = new PipedOutputStream();
InputStream instr = new PipedInputStream(out);
marshaller.marshal(object, out);
HttpPost post = new HttpPost();
post.setEntity(new InputStreamEntity(instr));

I have t validated this as I'm just on my phone but thats where id start. 
Always try to write to a stream wherever possible instead of building up in 
memory only to dump it out.

> But docs tell me that ByteArrayEntity is not thread-safe, while I need to use 
> HttpClient by conncurrent threads.

You would be only creating the entity per request, so thread safety is not an 
issue.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to