Feature #1224

Feature #1022: RCP: X.X, proxy settings in TXM and its components

RCP: X.X, Mac OS X proxy default configuration

Added by Matthieu Decorde over 4 years ago. Updated about 1 month ago.

Status:In Progress Start date:01/08/2015
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Network Spent time: -
Target version:TXM X.X

Description

There is no Eclipse plugin to manage system proxy configuration for Mac OS X (contrary to Linux and Windows).

We need to manage system proxy.

Solution 1

During the ApplicationWorkbenchAdvisor post startup, set ProxyService to "system".

Validation test

The fix does not works.

Solution 2

Set the ProxyService to "direct" and set server configuration using the OS proxy configuration (with java.net.ProxySelector).
The same method is use for R packages installation during the Mac OS X TXM installation. See #1116.

For TXM, the ProxyService is activated in the Application.activateProxyService() method during the first moments of TXM lifecycle in the run() method.

History

#1 Updated by Matthieu Decorde about 4 years ago

  • Parent task set to #1022

#2 Updated by Serge Heiden about 4 years ago

  • Description updated (diff)

#3 Updated by Matthieu Decorde almost 4 years ago

  • Description updated (diff)

#4 Updated by Sebastien Jacquot almost 4 years ago

Any feedback for this issue ? is the solution 2 has been implemented ?

#5 Updated by Sebastien Jacquot almost 4 years ago

  • Status changed from New to Feedback

#6 Updated by Sebastien Jacquot almost 4 years ago

  • Status changed from Feedback to In Progress

To set the Provider as "Manual" we can use:

IProxyService proxyService = (IProxyService)proxyTracker.getService();
proxyService.setProxiesEnabled(true);

I tried this in org.txm.utils.ProxyConf.ProxyConf(Object) and it well changes the provider from "Direct" to "Manual".
The potential problem is that it appears there are some HTTP connection tries BEFORE the call of org.txm.utils.ProxyConf.ProxyConf(Object).
Since we do not fetch the update at TXM first run it may finally doesn't be a problem. We could may call proxyService.setProxiesEnabled(true); only once at first run.
When TXM will quit, the configuration will be saved to org.eclipse.core.net.prefs therefore during next launches these preferences should be reloaded from this file.

proxyService.hasSystemProxies() seems to always return false on Mac OS X (maybe because there is no native implementation of org.eclipse.core.net for Mac OS X).

#7 Updated by Sebastien Jacquot almost 4 years ago

I propose this fix in org.txm.rcpapplication.Application.activateProxyService():

            // force active provider as "Manual" on Mac OS X
            if (Util.isMac() && System.getProperty("http.proxyHost") != null && ApplicationWorkbenchAdvisor.getWasFirstLaunch()) { 
                System.out.println("System proxy detected. Force network provider as manual.");
                proxyService.setProxiesEnabled(true); 

IMPORTANT NOTE: Log.info() etc. does NOT work at this level of starting. Therefore a lot of log messages may be skipped during start-up.

Matt, could you check that ApplicationWorkbenchAdvisor.getWasFirstLaunch() is well defined/filled at this starting step?

The purpose here is to force manual provider if a proxy system has been detected but only at first run. Then when user quits TXM the preference is saved.

#8 Updated by Matthieu Decorde almost 4 years ago

I used the "firstLaunchAfterInstallation" method which check if the TXM_HOME preference is set. Tested on Linux with Eclipse.

#9 Updated by Sebastien Jacquot almost 4 years ago

System.getProperty("http.proxyHost") returns null on Mac at this step of starting if we haven't call proxyService.setProxiesEnabled(true); before...
Maybe org.eclipse.core.net overrides these settings by loading the org.eclipse.core.net.prefs file.

#10 Updated by Sebastien Jacquot almost 4 years ago

I think calling the IProxyService activates it leading to a clearing of the Java proxy system properties, here is a test:

// Display the proxy host
System.err.println(System.getProperty("http.proxyHost"));

Bundle bundle = Platform.getBundle("org.eclipse.ui.ide"); //$NON-NLS-1$
IProxyService  proxyService = null;
if (bundle != null) {
    ServiceReference ref = bundle.getBundleContext().getServiceReference(IProxyService.class.getName());
    if (ref != null)
        proxyService = bundle.getBundleContext().getService(ref);
    }
}

// return null
System.err.println(System.getProperty("http.proxyHost"));

#11 Updated by Sebastien Jacquot almost 4 years ago

Mail FR: Pour info/trace.
proxyService.setProxiesEnabled(true);
passe bien le provider en manual sous Mac mais uniquement si on a déjà fait la manip suivante au moins une fois dans l'interface des prefs.
- passer en manual
- sauver
- passer en direct
- sauver
- redémarrer TXM avec le fix et ça store bien le "Manual"
Je pense que c'est lié à la gestion des prefs dans org.eclipse.core.net

#12 Updated by Sebastien Jacquot about 3 years ago

  • Target version changed from TXM 0.7.7 to TXM 0.8.0a (split/restructuration)

#13 Updated by Sebastien Jacquot 10 months ago

  • Target version changed from TXM 0.8.0a (split/restructuration) to TXM 0.8.0

#14 Updated by Matthieu Decorde about 1 month ago

  • Target version changed from TXM 0.8.0 to TXM X.X

Also available in: Atom PDF