Created
May 25, 2012 19:29
-
-
Save arschles/2790041 to your computer and use it in GitHub Desktop.
HttpService Async GET Requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public ResponseToProcess execute(ProcessedAPIRequest request, SDKServiceProvider provider) { | |
String url1 = "http://www.bing.com/search?q=kawasaki+ninja"; | |
GetRequest req1 = new GetRequest(url1); | |
String url2 = "http://www.bing.com/search?q=honda+nighthawk"; | |
GetRequest req2 = new GetRequest(url2); | |
String url3 = "http://www.bing.com/search?q=bmw+1300s"; | |
GetRequest req3 = new GetRequest(url3); | |
HttpService http = provider.getHttpService(); | |
Future<HttpResponse> resp1 = http.getAsync(req1); | |
Future<HttpResponse> resp2 = http.getAsync(req2); | |
Future<HttpResponse> resp3 = http.getAsync(req3); | |
Map<String, String> = new HashMap<String, String>(); | |
map.put("kawasaki_ninja_results", resp1.get.getBody()); | |
map.put("honda_nighthawk_results", resp2.get.getBody()); | |
map.put("bmw_1300s_results", resp3.get.getBody()); | |
return new ResponseToProcess(HttpURLConnection.HTTP_OK, map); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment