Hi Harsha, I think we can read the InputStream without consuming and write it to OutputStream. There you can can calculate the length.No need to build in to Object model . Refer [1]
[1] https://github.com/wso2/wso2-synapse/blob/master/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpSender.java On Mon, May 2, 2016 at 4:52 PM, Harsha Kumara <[email protected]> wrote: > Hi All, > > We have requirement to get the message size of request coming to APIM > Gateway to throttled based on bandwidth. To get the message size we have > following below approach > > 1) First check the Content-Length transport header is coming with the > request. If it present message length will be pick from the transport header > 2) If the Content-Length is not present, we are proceed with building the > message using RelayUtils and get the soapBody message size which is pretty > expensive method. > > Is this the best way to calculate the message length. Or do we have any > alternatives such as read the length from input stream? > > Thanks, > Harsha > > -- > Harsha Kumara > Software Engineer, WSO2 Inc. > Mobile: +94775505618 > Blog:harshcreationz.blogspot.com > -- Best Regards Isuru Ranawaka M: +94714629880 Blog : http://isurur.blogspot.com/
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
