Added extra checks to make sure that query methods marked with @RestResource(exported=false) aren't accidentally exported anyway.
This commit is contained in:
@@ -329,6 +329,9 @@ public class AbstractRepositoryRestController implements ApplicationContextAware
|
||||
LinkBuilder linkBuilder = BaseUriLinkBuilder.create(buildUri(baseUri, repoMapping.getPath(), "search"));
|
||||
ResourceMapping methodMapping = ResourceMappingUtils.merge(method,
|
||||
repoMapping.getResourceMappingFor(method.getName()));
|
||||
if(!methodMapping.isExported()) {
|
||||
continue;
|
||||
}
|
||||
links.add(linkBuilder.slash(methodMapping.getPath())
|
||||
.withRel(repoMapping.getRel() + "." + methodMapping.getRel()));
|
||||
}
|
||||
|
||||
@@ -57,10 +57,13 @@ public class RepositorySearchController extends AbstractRepositoryRestController
|
||||
}
|
||||
)
|
||||
@ResponseBody
|
||||
public Resource<?> list(RepositoryRestRequest repoRequest) {
|
||||
public Resource<?> list(RepositoryRestRequest repoRequest) throws ResourceNotFoundException {
|
||||
List<Link> links = new ArrayList<Link>();
|
||||
links.addAll(queryMethodLinks(repoRequest.getBaseUri(),
|
||||
repoRequest.getPersistentEntity().getType()));
|
||||
if(links.isEmpty()) {
|
||||
throw new ResourceNotFoundException();
|
||||
}
|
||||
return new Resource<Object>(Collections.emptyList(), links);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user