• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

REST client to get link URI's "dynamically" via rel="" values.

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi guys.

I have coded a REST webservice client, that interacts with a service that provides JSON-formatted resources. While my code is working fine, I would like to further decouple it from the actual REST-API structure in the way that HATEOAS is generally meant to be done.
I should add that I am using Jersey 2 for the interaction with the webservice, and thus a general resource-query against the service would like as follows:



Now, the next step is usually to request and read the resource at the targeted location as such



Or alternatively, to process the returned data (and this is the way I have consistently done it in my code thus far):


However.... I am positive that other than that kind of processing, I should also be able to "traverse" the webservice application by means of the links contained in the response.
It should work like this:

.. However this does not work. This is despite that I can confirm that the resource has links in it.
The returned resource has the following JSON format:


As you can see there are clearly some links in the returned resource, and yet, a call to getLinks() consistently returns an empty Set<Link>.

Does anyone know how to configure Jersey to successfully let me extract link URI's this way from a Response object?

// Andreas
 
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic