I seem to be missing something. I am trying to use this sample code
from the doc to access a proxy without
configuring the proxy parms.
One can also instruct HttpClient to use standard JRE proxy selector to
obtain proxy information:
DefaultHttpClient httpclient = new DefaultHttpClient();
ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
httpclient.getConnectionManager().getSchemeRegistry(),
ProxySelector.getDefault());
httpclient.setRoutePlanner(routePlanner);
My program is not an applet, it will eventually be a web start application.
The url is https.
I set up the default browser to use a proxy, then set the Java config
to use a proxy and my application will
not use the proxy.
Is there some other configuration or some other code that I need? Is
it the SSL?
Do I not understand what ProxySelectorRoutePlanner does?
Thanks.
Here is the code:
DefaultHttpClient cli = new DefaultHttpClient();
HttpGet method = new HttpGet(url);
HttpResponse resp = null;
HttpEntity ent = null;
method.addHeader("User-Agent", ServerComm.TheUserAgent);
ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
cli.getConnectionManager().getSchemeRegistry(),
ProxySelector.getDefault());
cli.setRoutePlanner(routePlanner);
//execute the method
String responseBody = null;
try{
resp = cli.execute(method);
ent = resp.getEntity();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]