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

      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.

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

                Created:
                Updated:
                Resolved: