@GET public List<Annotation> getAnnotations(@QueryParam("xpath") String xpath) { DocumentModel doc = getTarget().getAdapter(DocumentModel.class); AnnotationService annotationService = Framework.getService(AnnotationService.class); return annotationService.getAnnotations(getContext().getCoreSession(), doc.getId(), xpath); }