When using the DefaultHttpClient() from the Apache Commons HTTP Client, is it possible to show the full request in the console output for debugging purposes?
Yes, here's sample code:
import java.util.Arrays;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
...
HttpResponse response;
...
HttpGet httpGet = new HttpGet(serviceURL);
response = httpclient.execute(httpGet);
...
// Print all headers
List httpHeaders = Arrays.asList(response.getAllHeaders());
for (Header header : httpHeaders) {
System.out.println("Headers.. name,value:"+header.getName() + "," + header.getValue());
}