Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

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

 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • 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
 
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
ScroogeXHTML 8.7 - RTF to HTML5 and XHTML converter
https://coderanch.com/t/730700/ScroogeXHTML-RTF-HTML-XHTML-converter
    Bookmark Topic Watch Topic
  • New Topic