This example demonstrates how to use the declarative hyperlink annotations.
Some examples:
http://localhost:8080/rest/albums/1 Accept:application/hal+json
{
"id": "1",
"title": "Heritage",
"artistId": "1",
"stockLevel": 2,
"_links": {
"self": {
"href": "http://localhost:8080/rest/albums"
},
"artistId": {
"href": "http://localhost:8080/rest/artist"
}
}
}
http://localhost:8080/rest/albums Accept:application/hal+json
[
{
"id": "2",
"title": "Deliverance",
"artistId": "1",
"stockLevel": 3,
"_links": {
"self": {
"href": "http://localhost:8080/rest/albums"
},
"artistId": {
"href": "http://localhost:8080/rest/artist"
}
}
},
{
"id": "1",
"title": "Heritage",
"artistId": "1",
"stockLevel": 2,
"_links": {
"self": {
"href": "http://localhost:8080/rest/albums"
},
"artistId": {
"href": "http://localhost:8080/rest/artist"
}
}
}
]
- Open this project in Intellij.
- Create new local tomcat Run/Debug confihuration.
- Add new Build Artifacts in the "Before launch: Make, Build Artifacts" and select "jersey-declarative-linking:war exploded".
- Select available tomcat version.
- Open deployment tab and also add "jersey-declarative-linking:war exploded".
- Save, close and now you can run this project.