android - What exactly returns EntityUtils.toString(response)? -


i'm doing api rest , saw in lot of examples people use entityutils.tostring(response) response string get, post, put , delete methods. similar this:

httpget method = new httpget(url); method.setheader("content-type", "application/json"); httpresponse response = httpclient.execute(method); string responsestring = entityutils.tostring(response.getentity()); 

please avoid answers said me gives me string

i know returns me string content of entity (in case response) here doubts come, because i'm not secure string returns. saw official documentation.

read contents of entity , return string.

https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/util/entityutils.html#tostring(org.apache.http.httpentity,java.lang.string)

it content-type returned in string?

on contrary, values i'm getting method returned in string?

i think second 1 question i'm not secure that. and, in case true, how values stored string? separated comas or special character?

thanks in advance!

an httpentity represents content of body of http response. entityutils.tostring(httpentity) interprets content string , returns you.

if http response this

http/1.1 200 ok content-type: text/xml; charset=utf-8 content-length: 80  <?xml version="1.0" encoding="utf-8"?> <root>     <nested attr="whatever" /> </root> 

then string returned entityutils.tostring(httpentity) contain

<?xml version="1.0" encoding="utf-8"?> <root>     <nested attr="whatever" /> </root> 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -