Connecting through a proxy

Network proxies are becoming commonplace these days, they even appear in some home networks. For that reason there is an increasing need to support connecting through a proxy. Of course we’d want that in an aggregator too, so here goes.

In Eclipse we have shared proxy settings (General > Network Connections) that we should be using to obtain the required information for setting up a network connection.

First we implement the method that obtains the Eclipse proxy service. Notice that we’ll wait for the bundle to become active. If a user name and password is assigned to the proxy, Equinox Security Manager will ask you for a password before the bundle becomes active. It may take a while before everything is ready and the default timeout for obtaining the service is five seconds. So unless we wait it’s quite likely that would not get the service before it times out.

Next we’ll set up the proxy for the connection and use it. This is simply a matter of getting the required IProxyData. If it’s null we’re not going to need a proxy. Next we create the connection and specify credentials as required.

Note that while we’re using the proxy to download the feed data, it is not being used in XULRunner to download images and other media. More about that later.

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.