Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-8367

3.1.0.M2 update of the RestTemplate for Apache HTTP Components will default to sending 2 requests on authentication and doesn't support HttpContext parameters without significant extention/rewrite

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1 M2
    • Fix Version/s: 3.1 GA
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      Reference JIRA: https://jira.springsource.org/browse/SPR-6180?focusedCommentId=66682#comment-66682

      Any use cases which require an HttpContext attribute to be set aren't covered in this implementation, and the extensions required make the whole thing so messy as to make using the Rest Template more of a burden than a benefit. Here is the particular case that I've been fussing with today to little avail, setting preemptive authentication (i.e. send basic authentication headers by default rather than performing 2 requests to authenticate):

      http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e1023

      The problem being that the RestTemplate implementation as it is has no support for setting HttpContext parameters (the template calls the Http.execute(HttpUriRequest) which uses only the non-accessible default HttpContext), there aren't any good ways to set the default context parameters on the HttpClient in 4.x Apache HTTP Components. You end up needing to extend HttpClient to provide for default HttpContext params on the HttpClient object and the whole thing just becomes a spaghetti mess from there making the template more pain than pleasure.

        Attachments

          Activity

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              davidparks21 David Parks
              Last updater:
              Trevor Marshall
            • Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                6 years, 14 weeks, 2 days ago

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 19m
                19m