22 import com.nokia.carbide.installpackages.gen.InstallPackages.*; |
22 import com.nokia.carbide.installpackages.gen.InstallPackages.*; |
23 import com.nokia.carbide.installpackages.gen.InstallPackages.util.InstallPackagesResourceFactoryImpl; |
23 import com.nokia.carbide.installpackages.gen.InstallPackages.util.InstallPackagesResourceFactoryImpl; |
24 import com.nokia.carbide.remoteconnections.Messages; |
24 import com.nokia.carbide.remoteconnections.Messages; |
25 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
25 import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
26 import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider; |
26 import com.nokia.carbide.remoteconnections.interfaces.IRemoteAgentInstallerProvider; |
27 import com.nokia.cpp.internal.api.utils.core.Check; |
27 import com.nokia.cpp.internal.api.utils.core.*; |
28 import com.nokia.cpp.internal.api.utils.core.FileUtils; |
|
29 |
28 |
30 import org.apache.commons.httpclient.*; |
29 import org.apache.commons.httpclient.*; |
31 import org.apache.commons.httpclient.auth.AuthScope; |
30 import org.apache.commons.httpclient.auth.AuthScope; |
32 import org.apache.commons.httpclient.methods.GetMethod; |
31 import org.apache.commons.httpclient.methods.GetMethod; |
33 import org.eclipse.core.net.proxy.IProxyData; |
32 import org.eclipse.core.net.proxy.IProxyData; |
34 import org.eclipse.core.net.proxy.IProxyService; |
|
35 import org.eclipse.core.runtime.*; |
33 import org.eclipse.core.runtime.*; |
36 import org.eclipse.emf.common.util.EList; |
34 import org.eclipse.emf.common.util.EList; |
37 import org.eclipse.emf.common.util.URI; |
35 import org.eclipse.emf.common.util.URI; |
38 import org.eclipse.emf.ecore.resource.Resource; |
36 import org.eclipse.emf.ecore.resource.Resource; |
39 import org.eclipse.jface.operation.IRunnableContext; |
37 import org.eclipse.jface.operation.IRunnableContext; |
172 return loadPackages(url); |
170 return loadPackages(url); |
173 } |
171 } |
174 |
172 |
175 return null; |
173 return null; |
176 } |
174 } |
|
175 |
|
176 private static java.net.URI getURI(GetMethod getMethod) { |
|
177 try { |
|
178 return new java.net.URI(getMethod.getURI().toString()); |
|
179 } catch (Exception e) { |
|
180 RemoteConnectionsActivator.logError(e); |
|
181 } |
|
182 |
|
183 return null; |
|
184 } |
177 |
185 |
178 public static void setProxyData(HttpClient client, GetMethod getMethod) { |
186 public static void setProxyData(HttpClient client, GetMethod getMethod) { |
179 IProxyService proxyService = RemoteConnectionsActivator.getDefault().getProxyService(); |
187 java.net.URI uri = getURI(getMethod); |
180 boolean proxiesEnabled = proxyService.isProxiesEnabled(); |
188 if (uri == null) |
181 if (!proxiesEnabled) |
|
182 return; |
189 return; |
183 IProxyData proxyData = proxyService.getProxyData(IProxyData.HTTP_PROXY_TYPE); |
190 IProxyData proxyData = ProxyUtils.getProxyData(uri); |
|
191 if (proxyData == null) |
|
192 return; |
184 String host = proxyData.getHost(); |
193 String host = proxyData.getHost(); |
185 int port = proxyData.getPort(); |
194 int port = proxyData.getPort(); |
186 client.getHostConfiguration().setProxy(host, port); |
195 client.getHostConfiguration().setProxy(host, port); |
187 if (proxyData.isRequiresAuthentication()) { |
196 if (proxyData.isRequiresAuthentication()) { |
188 String userId = proxyData.getUserId(); |
197 String userId = proxyData.getUserId(); |