云存储java SDK设置代理出口

package com.sinacloud.lazy;

import javax.servlet.ServletException;  
import javax.servlet.annotation.WebServlet;  
import javax.servlet.http.HttpServlet;  
import javax.servlet.http.HttpServletRequest;  
import javax.servlet.http.HttpServletResponse;  
import java.io.IOException;  
import java.io.PrintWriter;  
import java.util.List;

import com.sina.cloudstorage.Protocol;  
import com.sina.cloudstorage.auth.AWSCredentials;  
import com.sina.cloudstorage.auth.BasicAWSCredentials;  
import com.sina.cloudstorage.services.scs.SCS;  
import com.sina.cloudstorage.services.scs.SCSClient;  
import com.sina.cloudstorage.services.scs.model.Bucket;  
import com.sina.cloudstorage.ClientConfiguration;

@WebServlet(name = "ServletDemo", urlPatterns = "/ServletDemo")
public class ServletDemo extends HttpServlet {  
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String accessKey = "AK";
        String secretKey = "SK";
        AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
        ClientConfiguration clientConig = new ClientConfiguration();
        // 设置代理
        clientConig.setProxyHost("10.13.144.234");
        clientConig.setProxyPort(8888);
        // 设置协议
        clientConig.setProtocol(Protocol.HTTP);
        SCSClient conn = new SCSClient(credentials, clientConig);
        List<Bucket> list = conn.listBuckets();
        response.setCharacterEncoding("UTF-8");    //设置响应的字符集格式为UTF-8
        response.setContentType("text/html");  //设置响应正文的MIME类型
        PrintWriter out = response.getWriter(); 
        out.println("====getAllBuckets===="+list);
        out.flush();
        out.close();
    }
}

可以从代理处设置 sinacloud.net的IP列表,比如固定到某一个,这样就可以控制ACL。