Подскажите как можно в этом скрипте получить headers все в виде массива ?
import java.net.URI;
import java.net.URISyntaxException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.apache.http.client.fluent.Async;
import org.apache.http.client.fluent.Content;
import org.apache.http.client.fluent.Request;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.concurrent.FutureCallback;
/**
* Java mass loader
*/
public class MassLoader {
/**
* Main method
*
* @param args
*/
public static void main(String[] args) {
URIBuilder builder = new URIBuilder();
builder.setScheme("http").setHost("google.com").setPath("/");
URI requestURL = null;
try {
requestURL = builder.build();
} catch (URISyntaxException use) {}
ExecutorService threadpool = Executors.newFixedThreadPool(100);
Async async = Async.newInstance().use(threadpool);
final Request request = Request.Get(requestURL);
for(int i=0; i < 100; i++) {
Future<Content> future = async.execute(request, new FutureCallback<Content>() {
public void failed (final Exception e) {
System.out.println(e.getMessage() +": "+ request);
}
public void completed (final Content content) {
System.out.println("Request completed: "+ request);
System.out.println("Response:\n"+ content.asString());
}
public void cancelled () {
System.out.print("Cancelled");
}
});
}
}
}