I am writing one client to measure Jersey, REST based web service performance. I have written some code to measure response time and to measure number of bytes sent from the server but response.getLength()
method always returning -1
.
In many QA forum I read that setting client.setChunkedEncodingSize(null)
will work but even after setting this, I am getting -1.
From server side, I am sending response of type XML or JSON or protobuf depending upon parameters sent by client. For all of these response types, I am getting response length as -1.
My actual request looks like below:
WebResource webResourceQuery = client.resource(requestUrl);
ClientResponse response = webResourceQuery.header("Authorization", header)
.accept(MediaType.APPLICATION_JSON)
.get(ClientResponse.class);
From server side, I am not setting content-length explicitly. Can anyone please help me in getting content-length on client side?
Whole purpose of this experiment is to measure which response type is more efficient in terms of response time and amount of data sent/received.