On Thu, 2015-12-17 at 18:20 +0100, Thomas Boniface wrote: > Hi, > > I would like to save as much resource as possible while sending JSON > requests using an http async client. > > I tried to implement my own HttpEntity hoping I could force jackson > serialization directly in the ouputsteam : > > @Override > public void writeTo(OutputStream outstream) throws IOException { > objectMapper.writeValue(outstream, bidRequest); > } > > Unfortunetly the client seems to pull the content to send from the > getContent method of the http entity. Using this method would force me to > first serialize my JSON objects into a byte array an create an inputsteam > from it. This may be better than serializing to a String and use and > StringEntity but it feels like there is still room for optimization. > > I saw a ZeroCopyPost but dedicated to files, is there a built in feature to > achive what I'm looking for (Zero copy post for in memory object) ? > > Thanks in advance > > Thomas
Thomas The term zero-copy applies only to socket to file or file to socket data transfer. If you want to write out any arbitrary request content you should implement a custom HttpAsyncContentProducer if none of the standard ones suit your needs. With content-length delineated connections one can effectively stream data directly to the underlying TCP channel. Hope this helps Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org