Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. {
  2. "_links":{
  3. "self":{
  4. "href":"http://localhost:8080/technologies"
  5. }
  6. },
  7. "_embedded":{
  8. "technologies":[
  9. {
  10. "id":1,
  11. "description":"A",
  12. "_links":{
  13. "self":{
  14. "href":"http://localhost:8080/technologies/1"
  15. }
  16. }
  17. },
  18. {
  19. "id":2,
  20. "description":"B",
  21. "_links":{
  22. "self":{
  23. "href":"http://localhost:8080/technologies/2"
  24. }
  25. }
  26. }
  27. ]
  28. }
  29. }
  30.  
  31. {
  32. "_links":{
  33. "self":{
  34. "href":"http://localhost:8080/technologies"
  35. }
  36. },
  37. "technologies":[
  38. {
  39. "id":1,
  40. "description":"A",
  41. "_links":{
  42. "self":{
  43. "href":"http://localhost:8080/technologies/1"
  44. }
  45. }
  46. },
  47. {
  48. "id":2,
  49. "description":"B",
  50. "_links":{
  51. "self":{
  52. "href":"http://localhost:8080/technologies/2"
  53. }
  54. }
  55. }
  56. ]
  57. }
  58.  
  59. @RestController
  60. @ExposesResourceFor(Technology.class)
  61. @RequestMapping(value = "/technologies")
  62. public class TechnologiesController {
  63. ...
  64. @ResquestMapping(method = RequestMethod.GET, produces = "application/vnd.xpto-technologies.text+json")
  65. public Resources<Resource<Technology>> getAllTechnologies() {
  66. List<Technology> technologies = technologyGateway.getAllTechnologies();
  67. Resources<<Resource<Technology>> resources = new Resources<Resource<Technology>>(technologyResourceAssembler.toResources(technologies));
  68. resources.add(linkTo(methodOn(TechnologiesController.class).getAllTechnologies()).withSelfRel());
  69. return resources;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement