[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] New topic in forum Eclipse Communications Framework (ECF), called Reuse Eclipse proxy handling when making HTTP connections, by Marcel Bruch

Title: Eclipse Community Forums
Subject: Reuse Eclipse proxy handling when making HTTP connections Author: Marcel Bruch Date: Thu, 24 July 2014 14:30

I'm currently struggling with making HTTP connections using proxies in Eclipse and I need a some pointers (and I hope to get them here).

We have several locations in code that do http requests. All these locations need to respect the user's proxy settings as specified in Eclipse preferences (native proxy, manual proxy, direct etc.).

Currently, I have to take care of this at every location, e.g. as shown below:

public HttpURLConnection getHttpURLConnection(URL url) throws IOException {
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
return (HttpURLConnection) url.openConnection(proxy);

I wonder whether there is something (besides IProxyService/ProxyData) that I could reuse to get the proxy handling right. For instance, in the example above: is there a way how this could be simplified using ECF?

Thanks for some pointers
[ Reply ][ Quote ][ View Topic/Message ][ Unsubscribe from this forum ]