habitats
habitats

Reputation: 2461

Capturing http with Fiddler using Jsoup (through Eclipse)

I'm trying to capture http data with Fiddler through Eclipse, using the Jsoup library for http requests.

I'm creating a new question because the others ones are addressing changes to HttpConnection etc., and I don't know how that corrolates with Jsoup. Excuse my ignorance.

I've tried adding the following to Eclipse VM run arguments (as described here: https://stackoverflow.com/a/7435339/992426):

-Dhttp.proxyHost=localhost
-Dhttp.proxyPort=8888

However, this doesn't seem to work.

I've also tried adding the following to my code:

Properties sysProperties = System.getProperties();
sysProperties.put("http.proxyHost", "127.0.0.1");
sysProperties.put("http.proxyPort", "8888");

Fiddler seems to be working fine with all my other applications.

Thanks in advance.

Upvotes: 0

Views: 643

Answers (1)

Niranjan
Niranjan

Reputation: 1834

Did you add those arguments to Eclipse VM or to VM Arguments in Eclipse's Run Configuration? Former doesn't make sense as your Program is launched on a new VM by Eclipse when you run it.

The below approach is working fine for me, and fiddler is able to intercept Jsoup requests.

public class JsoupTest
{
static{
    System.setProperty("http.proxyHost", "localhost");
    System.setProperty("http.proxyPort", "8888");
}

Upvotes: 2

Related Questions