HttpClient httpClient = new HttpClient();
HttpState state = new HttpState();
Credentials credentials = new UsernamePasswordCredentials(username, pwd);
state.setCredentials(AuthScope.ANY, credentials);
httpClient.setState(state);
PostMethod postMethod = new PostMethod(url);
postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler());
StringBuffer respStr = new StringBuffer();
try {
//请求参数压缩
GZIPOutputStream gzip = new GZIPOutputStream(out);
if (reqStr != null && !"".equals(reqStr)) {
gzip.write(reqStr.getBytes());
}
gzip