Package org.eclipse.core.net.proxy

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


            }
    }
  }
 
  public HTTPContextInformationProvider() {
    IProxyService proxyService = Plugin.getDefault().getProxyService();
    try {
      _httpClient = new DefaultHttpClient(proxyService, new URI(BASE_URL));
    } catch (URISyntaxException e) {
      // should not happen
    }
    proxyService.addProxyChangeListener(this);    
  }
View Full Code Here


    /* Check if Bundle is Stopped */
    if (activator == null)
      return null;

    IProxyService proxyService = activator.getProxyService();

    /* Check if Proxy is enabled */
    if (!proxyService.isProxiesEnabled())
      return null;

    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();
        }
View Full Code Here

   * @see
   * org.rssowl.core.connection.auth.ICredentialsProvider#setProxyCredentials
   * (org.rssowl.core.connection.auth.IProxyCredentials, java.net.URI)
   */
  public void setProxyCredentials(IProxyCredentials credentials, URI link) {
    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

   * @see
   * org.rssowl.core.connection.auth.ICredentialsProvider#deleteProxyCredentials
   * (java.net.URI)
   */
  public void deleteProxyCredentials(URI link) {
    IProxyService proxyService = Activator.getDefault().getProxyService();
    proxyService.setProxiesEnabled(false);
    //TODO System Properties are still set?
  }
View Full Code Here

  /*
   * @see org.rssowl.core.connection.auth.ICredentialsProvider#getProxyCredentials(java.net.URI)
   */
  public IProxyCredentials getProxyCredentials(URI link) {
    IProxyService proxyService = Activator.getDefault().getProxyService();

    /* Check if Proxy is enabled */
    if (!proxyService.isProxiesEnabled())
      return null;

    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();
        }
View Full Code Here

  /*
   * @see org.rssowl.core.connection.auth.ICredentialsProvider#setProxyCredentials(org.rssowl.core.connection.auth.IProxyCredentials,
   * java.net.URI)
   */
  public void setProxyCredentials(IProxyCredentials credentials, URI link) {
    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

  /*
   * @see org.rssowl.core.connection.auth.ICredentialsProvider#deleteProxyCredentials(java.net.URI)
   */
  public void deleteProxyCredentials(URI link) {
    IProxyService proxyService = Activator.getDefault().getProxyService();
    proxyService.setProxiesEnabled(false);
    //TODO System Properties are still set?
  }
View Full Code Here

    // no longer be available. Usually onl happens on shutdown.

    CloudFoundryPlugin plugin = CloudFoundryPlugin.getDefault();

    if (plugin != null) {
      IProxyService proxyService = plugin.getProxyService();

      // Only set proxies IF proxies are enabled (i.e a user has selected
      // MANUAL provider configuration in network preferences. If it is
      // direct,
      // then skip proxy settings.
      if (proxyService != null && proxyService.isProxiesEnabled()) {
        IProxyData[] existingProxies = proxyService.getProxyData();

        if (existingProxies != null) {

          // Now determine the protocol to obtain the correct proxy
          // type
View Full Code Here

  protected boolean getOriginalSystemProxiesEnabled() {
    return originalSystemProxiesEnabled;
  }

  public void run() throws CoreException {
    IProxyService proxyService = getProxyService();
    originalSystemProxiesEnabled = proxyService.isSystemProxiesEnabled();
    originalProxiesEnabled = proxyService.isProxiesEnabled();
    originalData = proxyService.getProxyData();

    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 {
      // restore proxy settings
      proxyService.setSystemProxiesEnabled(originalSystemProxiesEnabled);
      proxyService.setProxiesEnabled(originalProxiesEnabled);
      proxyService.setProxyData(originalData);
    }
  }
View Full Code Here

    new ProxyHandler("invalid.proxy.test", 8080) {

      @Override
      protected void handleProxyChange() throws CoreException {

        IProxyService proxyService = getProxyService();
        try {
          // Reset the client to use the new proxy settings
          connectClient();

          IModule[] modules = server.getModules();
          // Should fail, as its now going through invalid proxy
          serverBehavior.stopModule(modules, null);

          fail("Expected invalid.proxy.test failure");

        }
        catch (Exception e) {
          assertTrue(e.getCause().getMessage().contains("invalid.proxy.test"));
          ran[0] = true;
        }

        // Restore proxy settings and try again
        proxyService.setSystemProxiesEnabled(getOriginalSystemProxiesEnabled());
        proxyService.setProxiesEnabled(getOriginalProxiesEnabled());
        proxyService.setProxyData(getOriginalProxyData());

        connectClient();
        IModule[] modules = server.getModules();

        serverBehavior.stopModule(modules, null);
View Full Code Here

TOP

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

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.