hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: 400 bad request POSTing to Tomcat 7.0.42
Date Thu, 26 Feb 2015 08:52:23 GMT
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



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message