You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+29Lines changed: 29 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -306,6 +306,35 @@ Note that now the prefix `ex:` automatically appears before all rels which are n
306
306
307
307
Since the purpose of the `CurieProvider` API is to allow for automatic curie creation, you can define only one `CurieProvider` bean per application scope.
308
308
309
+
## Controlling the representation of links in HAL
310
+
Links behind a link-relation in HAL are serialized into a link-object if there is only one link, and into an array of link-objects if there is more than one link. Sometimes it is desirable to always serialize links behind certain link-relations into an array, regardless of whether there is one link or many. You can do this with with the `HalMultipleLinkRels` class:
Now, regardless of whether there is one link or many links behind the `order` rel, the link will always be wrapped inside an array:
326
+
327
+
```java
328
+
{
329
+
_links: {
330
+
self: { href:"http://myhost/person/1" },
331
+
"order": [
332
+
{ href:"http://myhost/person/1/orders/1" }
333
+
]
334
+
}
335
+
}
336
+
```
337
+
309
338
## Traverson
310
339
311
340
As of version 0.11 Spring HATEOAS provides an API for client side service traversal inspired by the [Traverson](https://blog.codecentric.de/en/2013/11/traverson/) JavaScript library.
0 commit comments