> On Thu, 2015-02-26 at 19:04 +1100, Brett Ryan wrote:
>>> 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));
> 
> A custom HttpEntity implementation that internally makes use of JAXB
> marshaling would be massively more efficient.
> 
> Oleg

Ok, now you're being mean, j/k ;)

Something like (I'm still on the train so this is probably totally wrong)

post.setEntity(new HttpEntity() {
    void write(OutputStream out) {
        marshaller.marshal(object, out);
    }
    // implement other methods too...
});

Half guessing, but where id start to look.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to