HttpClient支持使用代理服务器以及身份认证
HttpClientAuthenticationDoument:
http://hc.apache.org/httpclient-3.x/authentication.html
HttpClient支持使用代理服务器以及身份认证
1、代理服务器的设置很简单:
HttpClientclient=newHttpClient();
client.getHostConfiguration().setProxy(host,port);
2、身份验证:
HttpClientclient=newHttpClient();
client.getParams().setAuthenticationPreemptive(true);
Credentialsdefaultcreds=newUsernamePasswordCredentials("username","password");
client.getState().setCredentials(AuthScope.ANY,defaultcreds);
相关推荐
windle 2020-10-29
scaleqiao 2020-10-22
superyu 2020-09-10
xcznb 2020-06-26
LandryBean 2020-06-17
furongwei 2020-06-09
clmngu 2020-06-06
windzoone 2020-05-29
huangzonggui 2020-05-28
itmale 2020-05-26
BuildingUtil 2020-05-09
leodengzx 2020-05-11
MichelinMessi 2020-04-20
huangzonggui 2020-04-16
魏莉的微 2020-04-08
zongyuewang 2020-03-30
wxthillwill 2020-03-06
sicceer 2020-02-23
SoarFly00 2020-02-03