Sam Kruglov opened DATAREST-1179 and commented
Method in @RepositoryRestController:
@GetMapping(value = "users/{id}", params = "fields")
public ResponseEntity<MappingJacksonValue> getUser(@PathVariable("id") Long id,
@RequestParam(value = "fields") String fields,
HttpServletRequest request) {
Resource<User> userResource = new Resource<>(userRepository.findOne(id));
userResource.add(new Link(request.getRequestURL() + "?fields=" + fields).withSelfRel());
userResource.add(links.linkToSingleResource(userResource.getContent()).withRel("user"));
userResource.add(links.linkToSingleResource(userResource.getContent().getGroup()).withRel("group"));
MappingJacksonValue wrapper = new MappingJacksonValue(userResource);
wrapper.setFilters(new SimpleFilterProvider()
.addFilter("userFilter",
SimpleBeanPropertyFilter.filterOutAllExcept(fields.split(","))));
return ResponseEntity.ok(wrapper);
}
Accessing GET users/1?fields=firstName
{
"firstName": "John",
"links": [
{
"rel": "self",
"href": "http://localhost:8080/users/1?fields=firstName"
},
{
"rel": "user",
"href": "http://localhost:8080/users/1{?projection}"
},
{
"rel": "group",
"href": "http://localhost:8080/groups/1"
}
]
}
Expected _links instead of *links * and href to be inside rel
Affects: 2.6.9 (Ingalls SR9)
Sam Kruglov opened DATAREST-1179 and commented
Method in
@RepositoryRestController:Accessing GET users/1?fields=firstName
Expected _links instead of *links * and href to be inside rel
Affects: 2.6.9 (Ingalls SR9)