Open
Description
Given
Spring boot starter 2.0.1.RELEASE with hateoas, data-jpa
@SpringBootApplication
@EnableSpringDataWebSupport
public class Application { //}
@Component
public class PersonPublicReleaseAssembler extends ResourceAssemblerSupport<PersonPublicRelease, PersonPublicReleaseResource> {
@Override
public PersonPublicReleaseResource toResource(PersonPublicRelease personPublicRelease) {
/..........
personPublicReleaseResource.add(links);
return personPublicReleaseResource;
}
}
@Autowired
PagedResourcesAssembler<PersonPublicRelease> assembler;
@GetMapping("/search/finadAllWithPagnation")
public ResponseEntity<PagedResources<PersonPublicReleaseResource>> findAllWithPagnation(@PageableDefault Pageable pageable) {
Page<PersonPublicRelease> collection = personPublicReleaseRepository.findAll(pageable);
return ResponseEntity.ok(assembler.toResource(collection, new PersonPublicReleaseAssembler()));
}
Link to findAllWithPagnation() in search mapping(below)
@GetMapping("/search")
public ResponseEntity<ResourceSupport> getSearch() {
ResourceSupport resourceSupport = new ResourceSupport();
Link pageLink = linkTo(methodOn(PersonPublicReleaseController.class)
.findAllWithPagnation(null)).withRel("findAllByPagnation");
// Assemble the resource with links
resourceSupport.add(pageLink );
return ResponseEntity.ok(resourceSupport);
}
Self link returned in the finallAll gets generated fine with first, next, last etc, however
/search would render
{"_links":{"finadAllWithPagnation":{"href":"http://localhost:8080/edw-rest/api/personpr/search/finadAllWithPagnation"}}}
Was Expecting
{"_links":{"finadAllWithPagnation":{"href":"http://localhost:8080/edw-rest/api/personpr/search/finadAllWithPagnation{?page,size,sort}"}}}
Metadata
Metadata
Assignees
Labels
No labels