@GET public Property getClassProperty( @PathParam("wikiName") String wikiName, @PathParam("className") String className, @PathParam("propertyName") String propertyName) throws XWikiException { String database = Utils.getXWikiContext(componentManager).getDatabase(); try { Utils.getXWikiContext(componentManager).setDatabase(wikiName); com.xpn.xwiki.api.Class xwikiClass = Utils.getXWikiApi(componentManager).getClass(className); if (xwikiClass == null) { throw new WebApplicationException(Status.NOT_FOUND); } Class clazz = DomainObjectFactory.createClass( objectFactory, uriInfo.getBaseUri(), wikiName, xwikiClass); for (Property property : clazz.getProperties()) { if (property.getName().equals(propertyName)) { String classUri = UriBuilder.fromUri(uriInfo.getBaseUri()) .path(ClassResource.class) .build(wikiName, xwikiClass.getName()) .toString(); Link classLink = objectFactory.createLink(); classLink.setHref(classUri); classLink.setRel(Relations.CLASS); property.getLinks().add(classLink); return property; } } throw new WebApplicationException(Status.NOT_FOUND); } finally { Utils.getXWiki(componentManager).setDatabase(database); } }