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 09:30:27 GMT
On Thu, 2015-02-26 at 20:26 +1100, Brett Ryan wrote:
> > 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.

Yes, pretty much.

Cheers

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