DefaultHttpClient执行从浏览器带来不同的位置

时间:2017-03-23 08:52:48

标签: java

它似乎我有一个错误,但我无法在谷歌找到任何线索。 我有以下代码:

    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);

我试图在网址上运行它:http://annemergmed.com/action/consumeSharedSessionAction?JSESSIONID=aaaiJSrshFbnYctW3Q4Rv&MAID=I1JsdfY3Lc%2FzCjqdBXuiSQ%3D%3D&SERVER=WZ6myaEXBLHj3ZzqSv9HPw%3D%3D&ORIGIN=378011271&RD=RD&acw=&utt=

但我的位置与我在firebug中看到的位置不同。完全不同! (我在私人浏览中运行firebug) 怎么会这样?我错过了什么?

0 个答案:

没有答案