jalbouys / google-api-translate-java

Automatically exported from code.google.com/p/google-api-translate-java
0 stars 0 forks source link

你的代码太不完整了 #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
粗粗看了你的代码一下,觉得如下问题不做解决可能会影响��
�用。
1、代理服务器(ex)
Properties prop = System.getProperties();
prop.put("http.proxyHost","202.105.182.19");
prop.put("http.proxyPort","80");
我是从2006年就用google翻译来更新数据库里的指定内容。发现�
��果使用google翻译
过于频繁GOOGLE就会误认为你是来功击。所以我的做法是加入��
�多的代理服务器来做
轮询:
String urlstr = engineUrl + "?text=" + encodeText(translateText)
                + "&langpair=" + langpair;
        URL url = new URL(urlstr);
        Properties prop = System.getProperties();
        if (Integer.valueOf(OrderProxy)%10==0){
            prop.put("http.proxyHost","202.105.182.19");
            prop.put("http.proxyPort","80");    
        }else if (Integer.valueOf(OrderProxy)%9==0){
            prop.put("http.proxyHost","202.105.182.15");
            prop.put("http.proxyPort","80");    
        }else if (Integer.valueOf(OrderProxy)%8==0){
            prop.put("http.proxyHost","216.89.101.4");
            prop.put("http.proxyPort","80");    
        }else if (Integer.valueOf(OrderProxy)%7==0){
            prop.put("http.proxyHost","218.7.48.22");
            prop.put("http.proxyPort","8080");  
        }else if (Integer.valueOf(OrderProxy)%6==0){
            prop.put("http.proxyHost","222.89.169.73");
            prop.put("http.proxyPort","3128");  
        }else if (Integer.valueOf(OrderProxy)%5==0){
            prop.put("http.proxyHost","61.181.156.98");
            prop.put("http.proxyPort","3128");  
        }else if (Integer.valueOf(OrderProxy)%4==0){
            prop.put("http.proxyHost","218.25.105.18");
            prop.put("http.proxyPort","3128");  
        }else if (Integer.valueOf(OrderProxy)%3==0){
            prop.put("http.proxyHost","202.105.182.11");
            prop.put("http.proxyPort","80");    
        }else if (Integer.valueOf(OrderProxy)%2==0){
            prop.put("http.proxyHost","202.105.182.13");
            prop.put("http.proxyPort","80");    
        }else{
            prop.put("http.proxyHost","202.105.182.16");
            prop.put("http.proxyPort","80");
        }       

        URLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestProperty("User-agent", "IE/6.0");      
        connection.connect();
2、你的错误处理呢?如果实际使用用户因多种原因发生错误�
��,他们如何追溯?
heweiya@gmail.com

Original issue reported on code.google.com by hewe...@gmail.com on 29 Oct 2007 at 1:49

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

Original comment by rich.mid...@gmail.com on 29 Oct 2007 at 11:45

GoogleCodeExporter commented 8 years ago

Original comment by rich.mid...@gmail.com on 29 Oct 2007 at 11:46