我想通過我校網頁代理需要認證消耗使用Apache Wink framework在Java中RESTful Web服務通過Web代理消費RESTful Web服務
ClientConfig clientConfig = new ClientConfig();
clientConfig.proxyHost("proxy.school.com");
clientConfig.proxyPort(3128);
//nothing to set username and password :(
RestClient client = new RestClient(clientConfig);
Resource resource = client.resource("http://vimeo.com/api/v2/artist/videos.xml");
String response = resource.accept("text/plain").get(String.class);
我也嘗試使用BasicAuthSecurityHandler
,但它似乎可以用來直接進行身份驗證到Web服務器,而不是Web代理
BasicAuthSecurityHandler basicAuthHandler = new BasicAuthSecurityHandler();
basicAuthHandler.setUserName("username");
basicAuthHandler.setPassword("password");
config.handlers(basicAuthHandler);
它仍然無法與HTTP 407錯誤代碼:需要代理身份驗證。
我GOOGLE了我所能的最好,沒有想出了更好的通過網絡代理消耗從Java客戶端Web服務,如果有人有另外一種想法,隨時應對