This is a brief introduction to wiring in additional JAX-RS resources into Fedora 4.
Boilerplate
Code Block |
---|
@Component
@Scope("prototype")
@Path("/{path: .*}/fcr:text")
public class MyCustomTextExtractionEndpoint extends AbstractResource {
@InjectedSession
protected Session session;
private final Logger logger = getLogger(FedoraContent.class);
} |
...
Fedora 4 uses a "globbing" style path. The path to the node (object or datastream) comes first, and the action to perform is last. The "@Path" annotation will collect the best-match path up to your static part ("fcr:text").
- Note, for consistency with other Path suffixes, use all lowercase strings (e.g. use: "fcr:nodetype" instead of: "fcr:nodeType")
Try to make extensive use of TRACE-level logging (in addition to inline comments and javadoc comments, of course) to help expose the internal workings of your class in a sensible way to downstream users.
An Action
Here is an example API action:
...