Spring's RestTemplate and prefix in JSON body -


i'd use resttemplate obtain response server , process response in android app, server answers prefix (or variable) in json body, response looks similar this:

response={"foo":"bar"} 

is possible omit "response=" part som simple way, or need reimplement mappingjacksonhttpmessageconverter class?

thanks in advance

edit: it works now, following code based on newest springandroid (1.0.0 release). restteplate(true) constructor adds required convertors , request.tomap() builds multivaluemap, body type formhttpmessageconverter accepts.

httpheaders requestheaders = new httpheaders(); requestheaders.setcontenttype(new mediatype("application", "x-www-form-urlencoded"));  resttemplate resttemplate = new resttemplate(true); resttemplate.setrequestfactory(new httpcomponentsclienthttprequestfactory());  final string url = "http://www.dummy.org/herp/getderp"; string result = resttemplate.postforobject(url, request.tomap(), string.class); 

now have string on output, can extract json , parse that.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -