Programmer45
Jun 25th, 2012, 11:44 AM
As per my SO question here (http://stackoverflow.com/questions/11193205/spring-android-rest-response-size):
What is the best way to go about measuring the size of the response when using RESTTemplate?
I figure I'll have to count the bytes from the response somehow, but I'm not sure where to do that at.
I'm already extending RESTTemplate to allow for GZip compression, so I figure there is just a method in there I can override, if it's not already built in.
Most, if not all, of my requests are structured like so:
// Just applies app wide auth and SSL info, returns a GzipRestTemplate
RestTemplate r = RestTemplateFactory.make( mContext );
BaseModelListRequest jsonData = null;
jsonData = r.getForObject( uri[0], BaseModelListRequest.class );
And then later:
private LinkedHashMap< String, BaseModel[] > mObjects;
mObjects = jsonData.getAllContent();
If there is already a facility to do this, then I'm missing it in the docs, and if there isn't if someone could guide me as to what the most seamless insertion of such a function would be, I'd appreciate it very much.
What is the best way to go about measuring the size of the response when using RESTTemplate?
I figure I'll have to count the bytes from the response somehow, but I'm not sure where to do that at.
I'm already extending RESTTemplate to allow for GZip compression, so I figure there is just a method in there I can override, if it's not already built in.
Most, if not all, of my requests are structured like so:
// Just applies app wide auth and SSL info, returns a GzipRestTemplate
RestTemplate r = RestTemplateFactory.make( mContext );
BaseModelListRequest jsonData = null;
jsonData = r.getForObject( uri[0], BaseModelListRequest.class );
And then later:
private LinkedHashMap< String, BaseModel[] > mObjects;
mObjects = jsonData.getAllContent();
If there is already a facility to do this, then I'm missing it in the docs, and if there isn't if someone could guide me as to what the most seamless insertion of such a function would be, I'd appreciate it very much.