hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Boniface <tho...@stickyads.tv>
Subject Zero Copy JSON serialization
Date Thu, 17 Dec 2015 17:20:22 GMT

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 :

    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


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message