Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2445

getlink(rel) does not work with things like github api pagination due to not splitting headers correctly

    XMLWordPrintable

Details

    Description

      when trying to write the simplest example using jaxrs/resteasy to access github rest api the pagination fails.

      Full example is https://github.com/maxandersen/ghlint but the gist is that when you are calling response.getLink("next") to get the "next" headers in github api it returns the wrong link on page 2 as it does not seem to parse the headers correctly.

      The headers are:
      Link=<https://api.github.com/repositories/139914932/labels?page=1>; rel="prev", <https://api.github.com/repositories/139914932/labels?page=3>; rel="next", <https://api.github.com/repositories/139914932/labels?page=3>; rel="last", <https://api.github.com/repositories/139914932/labels?page=1>; rel="first"

      and in this case jaxrs returns "https://api.github.com/repositories/139914932/labels?page=1" for prev,next,last,first where it obviously shuold return "https://api.github.com/repositories/139914932/labels?page=3" for next and last.

      Doing the exact same kind of logic in python or ruby just works - thus I would say something is not right here in java land

      found and discussed in chat here hinting the cause of issue is that ManualClosingApacheHttpClient43Engine.extractHeaders does NOT do comma splitting.

      Attachments

        1. 54A46878-ACA3-465C-B04F-34F80B82C248.png
          483 kB
          Weinan Li
        2. A3C9F157-B484-41BC-8462-E3D5C01A80D9.png
          561 kB
          Weinan Li
        3. screenshot-1.png
          687 kB
          Weinan Li

        Issue Links

          Activity

            People

              weli@redhat.com Weinan Li
              manderse@redhat.com Max Andersen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: