Package org.geoforge.lang.net

Source Code of org.geoforge.lang.net.GfrProxySelector

/*
*  Copyright (C) 2011-2014 GeoForge Project
*
*  This program is free software: you can redistribute it and/or modify
*  it under the terms of the GNU Lesser General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public License
*  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package org.geoforge.lang.net;

import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.util.Iterator;
import java.util.List;

/**
*
* @author bantchao
*
* tempo code and place!
* for debugging wwd
*/
public class GfrProxySelector
{
   //final static private String _STR_URL_ = "http://www.google.com/http://worldwind27.arc.nasa.gov/wms/virtualearth/";
   final static private String _STR_URL_ = "http://worldwind26.arc.nasa.gov/wms?EXCEPTIONS=application/vnd.ogc.se_xml&REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0";
  
   final static private String STR_TOTO = "GfrProxySelector.doJob()";
  
   static public void doJob()
   {
        try
        {
           
            //System.setProperty("java.net.useSystemProxies","true");
           
           List l = ProxySelector.getDefault().select(
                        new URI(_STR_URL_));
           
            for (Iterator iter = l.iterator(); iter.hasNext(); ) {
               
                Proxy proxy = (Proxy) iter.next();
               
                //System.out.println(">> " + STR_TOTO + " - url=" + _STR_URL_);
                //System.out.println(">> " + STR_TOTO + " - proxy.type()=" + proxy.type());
               
                InetSocketAddress addr = (InetSocketAddress)
                    proxy.address();
               
                if(addr == null)
                {
                    //System.out.println(">> " + STR_TOTO + " - No Proxy"); 
                }
               
                else
                {  
                    //System.out.println(">> " + STR_TOTO + " - InetSocketAddress.getHostName()=" + addr.getHostName());
                    //System.out.println(">> " + STR_TOTO + " - InetSocketAddress.getPort()=" +  addr.getPort());
                }
            }
        }
       
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
  
  
   private GfrProxySelector() {}
}
TOP

Related Classes of org.geoforge.lang.net.GfrProxySelector

TOP
Copyright © 2018 www.massapi.com. 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.