addConversation(id, new Date(), request, response, origin);
return id;
}
private void configureHTTPClient() {
HTTPClientFactory factory = HTTPClientFactory.getInstance();
String prop = null;
String value;
int colon;
try {
// FIXME for some reason, we get "" instead of null for value,
// and do not use our default value???
prop = "WebScarab.httpProxy";
value = Preferences.getPreference(prop);
if (value == null || value.equals("")) value = ":3128";
colon = value.indexOf(":");
factory.setHttpProxy(value.substring(0,colon), Integer.parseInt(value.substring(colon+1).trim()));
prop = "WebScarab.httpsProxy";
value = Preferences.getPreference(prop);
if (value == null || value.equals("")) value = ":3128";
colon = value.indexOf(":");
factory.setHttpsProxy(value.substring(0,colon), Integer.parseInt(value.substring(colon+1).trim()));
prop = "WebScarab.noProxy";
value = Preferences.getPreference(prop, "");
if (value == null) value = "";
factory.setNoProxy(value.split(" *, *"));
int connectTimeout = 30000;
prop = "HttpClient.connectTimeout";
value = Preferences.getPreference(prop,"");
if (value != null && !value.equals("")) {
try {
connectTimeout = Integer.parseInt(value);
} catch (NumberFormatException nfe) {}
}
int readTimeout = 0;
prop = "HttpClient.readTimeout";
value = Preferences.getPreference(prop,"");
if (value != null && !value.equals("")) {
try {
readTimeout = Integer.parseInt(value);
} catch (NumberFormatException nfe) {}
}
factory.setTimeouts(connectTimeout, readTimeout);
} catch (NumberFormatException nfe) {
_logger.warning("Error parsing property " + prop + ": " + nfe);
} catch (Exception e) {
_logger.warning("Error configuring the HTTPClient property " + prop + ": " + e);
}
factory.setAuthenticator(_credentialManager);
}