Example #1
0
  /**
   * Returns the corresponding registry entry which wraps a node of type "exo:registryEntry"
   *
   * @param entryPath The relative path to the registry entry
   * @response {code} "entryStream" : the output stream corresponding registry entry which wraps a
   *     node of type "exo:registryEntry {code} Example : {code:xml} <Audit
   *     jcr:primaryType="exo:registryEntry"> <adminIdentity jcr:primaryType="nt:unstructured"
   *     value="*:/Platform/Administrators"/> </Audit> {code} @LevelAPI Experimental
   */
  @GET
  @Path("/{entryPath:.+}")
  @Produces(MediaType.APPLICATION_XML)
  public Response getEntry(@PathParam("entryPath") String entryPath) {

    SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
    try {
      RegistryEntry entry;
      entry = regService.getEntry(sessionProvider, normalizePath(entryPath));
      return Response.ok(new DOMSource(entry.getDocument())).build();
    } catch (PathNotFoundException e) {
      return Response.status(Response.Status.NOT_FOUND).build();
    } catch (RepositoryException e) {
      LOG.error("Get registry entry failed", e);
      throw new WebApplicationException(e);
    }
  }