Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
 /**
     * Create an anonymous DS with a newly minted name
     * and content from request body
     * @param pathList
     * @throws RepositoryException 
     */
    @GET
    @Timed
    public String extractText(@PathParam("path")
    final List<PathSegment> pathList) {
       String path = toPath(pathList);
 
       try {
         final FedoraResource resource =
                    nodeService.getObject(session, path);
 
         // do stuff
         return "";
 
       } finally {
         session.logout();
       }
 
    }

...

The "pathList" contains the full REST path up to the static part of the request. Fedora's AbstractResource provides the helper method "toPath" to turn that into a node path. This path can then be used in any of Fedora's Services (or even direct JCR access, although we discourage reaching that far down the stack from a REST endpoint, and instead break the functionality into the high-level REST API and some low-level services).

...