vendredi 20 mars 2015

How to display a link on a particular rel as an array even if there is only one link


for (Person person : company.getPersons()) {
resource.add(linkTo(methodOn(PersonController.class).view(person.getId()))
.withRel("persons"));
}


I want to return an array of links by "persons" rel. It's all ok if I have multiple persons, but if I have only a single person it returns a single element and my client code that expects array fails.


Aucun commentaire:

Enregistrer un commentaire