参考文章:
http://stackoverflow.com/questions/10850114/httpclient-4-2-basic-authentication-and-authscope
http://hc.apache.org/httpclient-3.x/authentication.html
设置方法:
final HttpClient client = new HttpClient();
client.getParams().setAuthenticationPreemptive(true);
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(user.getUsername(), user.getPassword()));
final GetMethod method = new GetMethod(uri);
client.executeMethod(method);