Added extra checks to make sure that query methods marked with @RestResource(exported=false) aren't accidentally exported anyway.

This commit is contained in:
Jon Brisbin
2013-03-26 14:00:25 -05:00
parent 024173f724
commit 9c81264d52
3 changed files with 174 additions and 167 deletions

View File

@@ -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()));
}

View File

@@ -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);
}