Get Size of HTTP Response in Java
问题 I would like to know how much data was sent in response to a certain http-request. What I currently do is this: HttpURLConnection con = (HttpURLConnection) feedurl.openConnection(); //check the response for the content-size int feedsize = con.getContentLength(); The problem is, that content-legnth is not always set. E.g. when the server uses transfer-encoding=chunked I get back a value of -1. I do not need this to display progress information. I just need to know the size of the data that was