Package com.teamdev.jxbrowser.proxy

Examples of com.teamdev.jxbrowser.proxy.ProxyConfig


  private static boolean proxyAuthenticationInitialized = false;

  public static void updateJXBrowserProxy()
  {
    ProxyConfig proxyConf = BrowserServices.getInstance().getProxyConfig();
    if( proxyConf == null )
      return;

    try
    {
      proxyConf.setAutoDetectForNetwork( false );

      if( !proxyAuthenticationInitialized )
      {
        proxyConf.setAuthenticationHandler( ServerType.HTTP, new AuthenticationHandler()
        {
          @Override
          public ProxyServerLogin authenticationRequired( ServerType arg0 )
          {
            Settings settings = SoapUI.getSettings();
            PropertyExpansionContext context = null;

            String proxyUsername = PropertyExpander.expandProperties( context,
                settings.getString( ProxySettings.USERNAME, null ) );
            String proxyPassword = PropertyExpander.expandProperties( context,
                settings.getString( ProxySettings.PASSWORD, null ) );

            return new ProxyServerLogin( proxyUsername, proxyPassword );
          }
        } );

        proxyAuthenticationInitialized = true;
      }

      if( ProxyUtils.isProxyEnabled() )
      {
        Settings settings = SoapUI.getSettings();
        PropertyExpansionContext context = null;

        // check system properties first
        String proxyHost = System.getProperty( "http.proxyHost" );
        String proxyPort = System.getProperty( "http.proxyPort" );

        if( proxyHost == null )
          proxyHost = PropertyExpander.expandProperties( context, settings.getString( ProxySettings.HOST, "" ) );

        if( proxyPort == null )
          proxyPort = PropertyExpander.expandProperties( context, settings.getString( ProxySettings.PORT, "" ) );

        proxyConf.setProxy( ServerType.HTTP, new ProxyServer( proxyHost, Integer.parseInt( proxyPort ) ) );
        // check excludes
        proxyConf.setExceptions( PropertyExpander.expandProperties( context,
            settings.getString( ProxySettings.EXCLUDES, "" ) ) );
      }
      else
      {
        proxyConf.setDirectConnection();
      }
    }
    catch( Throwable e )
    {
    }
View Full Code Here

TOP

Related Classes of com.teamdev.jxbrowser.proxy.ProxyConfig

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.