Back to project page simple-json-android-exercise.
The source code is released under:
Apache License
If you think the Android project simple-json-android-exercise listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
// // DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations. ////from www .j a v a 2s . co m package com.example.simplejsonapp.rest; import java.util.HashMap; import com.example.simplejsonapp.entity.User; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.converter.json.GsonHttpMessageConverter; import org.springframework.web.client.RestTemplate; public class SimpleRestClient_ implements SimpleRestClient { private RestTemplate restTemplate; private String rootUrl; public SimpleRestClient_() { restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new GsonHttpMessageConverter()); rootUrl = "http://192.168.0.3:8080"; } @Override public User getUserById(String id) { HashMap<String, Object> urlVariables = new HashMap<String, Object>(); urlVariables.put("id", id); HttpHeaders httpHeaders = new HttpHeaders(); HttpEntity<Object> requestEntity = new HttpEntity<Object>(httpHeaders); return restTemplate.exchange(rootUrl.concat("/getUser?userId={id}"), HttpMethod.GET, requestEntity, User.class, urlVariables).getBody(); } }