Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "_links":{
- "self":{
- "href":"http://localhost:8080/technologies"
- }
- },
- "_embedded":{
- "technologies":[
- {
- "id":1,
- "description":"A",
- "_links":{
- "self":{
- "href":"http://localhost:8080/technologies/1"
- }
- }
- },
- {
- "id":2,
- "description":"B",
- "_links":{
- "self":{
- "href":"http://localhost:8080/technologies/2"
- }
- }
- }
- ]
- }
- }
- {
- "_links":{
- "self":{
- "href":"http://localhost:8080/technologies"
- }
- },
- "technologies":[
- {
- "id":1,
- "description":"A",
- "_links":{
- "self":{
- "href":"http://localhost:8080/technologies/1"
- }
- }
- },
- {
- "id":2,
- "description":"B",
- "_links":{
- "self":{
- "href":"http://localhost:8080/technologies/2"
- }
- }
- }
- ]
- }
- @RestController
- @ExposesResourceFor(Technology.class)
- @RequestMapping(value = "/technologies")
- public class TechnologiesController {
- ...
- @ResquestMapping(method = RequestMethod.GET, produces = "application/vnd.xpto-technologies.text+json")
- public Resources<Resource<Technology>> getAllTechnologies() {
- List<Technology> technologies = technologyGateway.getAllTechnologies();
- Resources<<Resource<Technology>> resources = new Resources<Resource<Technology>>(technologyResourceAssembler.toResources(technologies));
- resources.add(linkTo(methodOn(TechnologiesController.class).getAllTechnologies()).withSelfRel());
- return resources;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement