Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-245

customize handling of 302 redirects

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0 Final
    • 4.0 Alpha 1
    • HttpClient (classic)
    • None
    • Operating System: Linux
      Platform: Other
    • 21584

    Description

      I tried this with both the beta2 2.0 release, and the nightly build. The
      following code snippet describes what I am trying to do:

      httpClient.getHostConfiguration().setHost(sHost, 80, "http");
      HttpMethod method=null;
      if (sMethod.indexOf("POST")!=-1) {
      method=new PostMethod(sURLInfo);
      } else {
      method=new GetMethod(sURLInfo);
      }
      method.setFollowRedirects(true);
      httpClient.executeMethod(method);

      After this code executes, the "getFollowRedirects" method still returns false,
      and any redirects which are sent by the webserver are not followed. As a
      temporary workaround, since I want all redirects followed, I commented out the
      following code in the HttpMethodBase class in the "processRedirectResponse" method:

      /*if (!getFollowRedirects()) {
      LOG.info("Redirect requested but followRedirects is "
      + "disabled");
      return false;
      }*/

      If this bug has already been reported, I apologize...I searched for and found
      nothing related to this issue.

      Attachments

        Activity

          People

            Unassigned Unassigned
            delonad@netdoor.com Aaron DeLong
            Votes:
            3 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: