Package org.eclipse.core.net.proxy

Examples of org.eclipse.core.net.proxy.IProxyData


  private void updateProxySettings() {
    if (_proxyService != null && _proxyService.isProxiesEnabled()) {
      IProxyData[] proxies = _proxyService.select(_uri);
      if (proxies != null && proxies.length > 0) {
        IProxyData proxy = proxies[0];
        getHostConfiguration().setProxy(proxy.getHost(), proxy.getPort());
        if (proxy.isRequiresAuthentication()) {
          Credentials credentials = new UsernamePasswordCredentials(proxy.getUserId(), proxy.getPassword());
          getState().setProxyCredentials(AuthScope.ANY, credentials);       
        } else {
          getState().setProxyCredentials(AuthScope.ANY, null);
        }
      } else {
View Full Code Here


    String host = URIUtils.safeGetHost(link);
    boolean isSSL = "https".equals(link.getScheme()); //$NON-NLS-1$

    /* Retrieve Proxy Data */
    final IProxyData proxyData = proxyService.getProxyDataForHost(host, isSSL ? IProxyData.HTTPS_PROXY_TYPE : IProxyData.HTTP_PROXY_TYPE);
    if (proxyData != null) {
      return new IProxyCredentials() {
        public String getHost() {
          return proxyData.getHost();
        }

        public int getPort() {
          return proxyData.getPort();
        }

        public String getDomain() {
          return null;
        }

        public String getPassword() {
          return proxyData.getPassword();
        }

        public String getUsername() {
          return proxyData.getUserId();
        }
      };
    }

    /* Feed does not require Proxy or Credentials not supplied */
 
View Full Code Here

    IProxyService proxyService = Activator.getDefault().getProxyService();
    proxyService.setProxiesEnabled(true);
    boolean isSSL = "https".equals(link.getScheme()); //$NON-NLS-1$

    /* Retrieve Proxy Data */
    final IProxyData proxyData = proxyService.getProxyData(isSSL ? IProxyData.HTTPS_PROXY_TYPE : IProxyData.HTTP_PROXY_TYPE);
    if (proxyData != null) { //TODO What if Data is NULL?
      proxyData.setHost(credentials.getHost());
      proxyData.setPort(credentials.getPort());
      proxyData.setUserid(credentials.getUsername());
      proxyData.setPassword(credentials.getPassword());
    }
  }
View Full Code Here

    String host = link.getHost();
    boolean isSSL = "https".equals(link.getScheme());

    /* Retrieve Proxy Data */
    final IProxyData proxyData = proxyService.getProxyDataForHost(host, isSSL ? IProxyData.HTTPS_PROXY_TYPE : IProxyData.HTTP_PROXY_TYPE);
    if (proxyData != null) {
      return new IProxyCredentials() {
        public String getHost() {
          return proxyData.getHost();
        }

        public int getPort() {
          return proxyData.getPort();
        }

        public String getDomain() {
          return null;
        }

        public String getPassword() {
          return proxyData.getPassword();
        }

        public String getUsername() {
          return proxyData.getUserId();
        }
      };
    }

    /* Feed does not require Proxy or Credentials not supplied */
 
View Full Code Here

    IProxyService proxyService = Activator.getDefault().getProxyService();
    proxyService.setProxiesEnabled(true);
    boolean isSSL = "https".equals(link.getScheme());

    /* Retrieve Proxy Data */
    final IProxyData proxyData = proxyService.getProxyData(isSSL ? IProxyData.HTTPS_PROXY_TYPE : IProxyData.HTTP_PROXY_TYPE);
    if (proxyData != null) { //TODO What if Data is NULL?
      proxyData.setHost(credentials.getHost());
      proxyData.setPort(credentials.getPort());
      proxyData.setUserid(credentials.getUsername());
      proxyData.setPassword(credentials.getPassword());
    }
  }
View Full Code Here

    try {
      // set new proxy
      proxyService.setSystemProxiesEnabled(false);
      proxyService.setProxiesEnabled(enableProxies);
      IProxyData[] data = proxyService.getProxyData();
      IProxyData matchedData = null;

      for (IProxyData singleData : data) {
        if (singleData.getType().equals(proxyDataType)) {
          matchedData = singleData;
          break;
        }
      }

      if (matchedData == null) {
        throw new CoreException(CloudFoundryPlugin.getErrorStatus("No matched proxy data type found for: "
            + proxyDataType));
      }

      matchedData.setHost(host);
      matchedData.setPort(port);
      proxyService.setProxyData(data);

      handleProxyChange();
    }
    finally {
View Full Code Here

          port = 80;
        }
        type = IProxyData.HTTP_PROXY_TYPE;
        client.getHostConfiguration().setHost(u.getHost(), port);
      }
      IProxyData proxyData = Activator.getDefault().getProxyService().getProxyDataForHost(u.getHost(), type);
      if (proxyData != null) {
        client.getHostConfiguration().setProxy(proxyData.getHost(), proxyData.getPort());
        if (proxyData.isRequiresAuthentication()) {
          client.getState().setProxyCredentials(new AuthScope(proxyData.getHost(), proxyData.getPort()),
              new UsernamePasswordCredentials(proxyData.getUserId(), proxyData.getPassword()));
        }
      }
      client.getParams().setConnectionManagerTimeout(1000);
      client.getHttpConnectionManager().getParams().setConnectionTimeout(2000);
      client.getParams().setSoTimeout(3000);
View Full Code Here

          port = 80;
        }
        type = IProxyData.HTTP_PROXY_TYPE;
        client.getHostConfiguration().setHost(u.getHost(), port);
      }
      IProxyData proxyData = Activator.getDefault().getProxyService().getProxyDataForHost(u.getHost(), type);
      if (proxyData != null) {
        client.getHostConfiguration().setProxy(proxyData.getHost(), proxyData.getPort());
        if (proxyData.isRequiresAuthentication()) {
          client.getState().setProxyCredentials(new AuthScope(proxyData.getHost(), proxyData.getPort()),
              new UsernamePasswordCredentials(proxyData.getUserId(), proxyData.getPassword()));
        }
      }
      client.getParams().setConnectionManagerTimeout(1000);
      client.getHttpConnectionManager().getParams().setConnectionTimeout(2000);
      client.getParams().setSoTimeout(3000);
View Full Code Here

        client.getHostConfiguration().setHost(u.getHost(), u.getPort(), new Protocol("https", (ProtocolSocketFactory) new EasySSLProtocolSocketFactory(), 443));
      } else {
        type = IProxyData.HTTP_PROXY_TYPE;
        client.getHostConfiguration().setHost(u.getHost(), u.getPort());
      }
      IProxyData proxyData = Activator.getDefault().getProxyService().getProxyDataForHost(u.getHost(), type);
      if (proxyData != null) {
        client.getHostConfiguration().setProxy(proxyData.getHost(), proxyData.getPort());
        if (proxyData.isRequiresAuthentication()) {
          client.getState().setProxyCredentials(new AuthScope(proxyData.getHost(), proxyData.getPort()),
              new UsernamePasswordCredentials(proxyData.getUserId(), proxyData.getPassword()));
        }
      }
      client.getParams().setConnectionManagerTimeout(1000);
      client.getParams().setSoTimeout(1000);
      return client;
View Full Code Here

        client.getHostConfiguration().setHost(u.getHost(), u.getPort(), new Protocol("https", (ProtocolSocketFactory) new EasySSLProtocolSocketFactory(), 443));
      } else {
        type = IProxyData.HTTP_PROXY_TYPE;
        client.getHostConfiguration().setHost(u.getHost(), u.getPort());
      }
      IProxyData proxyData = Activator.getDefault().getProxyService().getProxyDataForHost(u.getHost(), type);
      if (proxyData != null) {
        client.getHostConfiguration().setProxy(proxyData.getHost(), proxyData.getPort());
        if (proxyData.isRequiresAuthentication()) {
          client.getState().setProxyCredentials(new AuthScope(proxyData.getHost(), proxyData.getPort()),
              new UsernamePasswordCredentials(proxyData.getUserId(), proxyData.getPassword()));
        }
      }
      client.getParams().setConnectionManagerTimeout(1000);
      client.getParams().setSoTimeout(1000);
      return client;
View Full Code Here

TOP

Related Classes of org.eclipse.core.net.proxy.IProxyData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.