HAL resource representations builder for spray-json
Cross-built for Scala 2.10 and 2.11
Resource class acts as a hal builder. Main methods are link and embed.
There is support for uri templates.
You still have to provide JsonProtocol for your domain classes.
Additional uri properties may be added with prop method on links.
It’s still possible to have String or spray’s Path link with props.
There are 3 string interpolators at your service:
u - absolute uri
r - relative uri (relative to parent resource uri)
t - absolute uri template; checks for RFC 6570) compliance
It possible to append path parts to uris with /.
Use u and r interpolation for DRY links
Use prop on u, r, t or String.
Embedding resource property
Embedding related resource
Multilevel embedding with relative links
embed inside another embed with relative links.
u, r and spray’s Path parts are encoded, when String is lifted to spray’s Path type.
One important thing to know, is when your path segment contains ‘/’ - correct way to have it encoded is following:
otherwise / will be parsed as path separator.
URL template encoding
Put the part into string interpolator arguments, like this: