我正在尝试通过需要身份验证的学校网络代理使用Apache Wink 框架在 java 中使用宁静的网络服务
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 错误代码:需要代理身份验证。
我已经尽我所能搜索了,没有比通过 Web 代理从 Java 客户端使用 Web 服务更好的方法了,如果有人有其他想法,请随时回复