它似乎我有一个错误,但我无法在谷歌找到任何线索。 我有以下代码:
DefaultHttpClient httpClient = new DefaultHttpClient();
setupHTTPS(httpClient);
HttpContext context = new BasicHttpContext();
// set proxy data, if available
if (proxyHost != null) {
httpClient.getCredentialsProvider().setCredentials(new AuthScope(proxyHost, proxyPort), new UsernamePasswordCredentials(proxyUsername, proxyPassword));
HttpHost proxy = new HttpHost(proxyHost, proxyPort);
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
httpClient.setRedirectStrategy(redirectStrategy);
HttpGet request = new HttpGet(url);
// allow circle redirect with limiting the numbers of redirects
httpClient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true);
httpClient.getParams().setParameter(ClientPNames.MAX_REDIRECTS, 50);
// set userAgent , if available
if(userAgent!=null){
setUserAgentForHttpClient(userAgent,httpClient);
}
HttpResponse response = httpClient.execute(request, context);
RedirectLocations locations = (RedirectLocations) context.getAttribute(DefaultRedirectStrategy.REDIRECT_LOCATIONS);
但我的位置与我在firebug中看到的位置不同。完全不同! (我在私人浏览中运行firebug) 怎么会这样?我错过了什么?