Spring for GoogleSearch (安卓版 Android)

// The connection URL (统一资源服务器连接)
String url = “https://ajax.googleapis.com/ajax/” +
“services/search/web?v=1.0&q={query}”;

// Create a new RestTemplate instance (产生Rest新模板)
RestTemplate restTemplate = new RestTemplate();

// Add the String message converter (添加String 信息转化器)
restTemplate.getMessageConverters().add(new StringHttpMessageConverter());

// Make the HTTP GET request, marshaling the response to a String
String result = restTemplate.getForObject(url, String.class, “Android”);

发布了31 篇原创文章 · 获赞 3 · 访问量 821

猜你喜欢

转载自blog.csdn.net/weixin_45806384/article/details/104539371