http://localhost:8080/dspace-rest/collections
The code isn't complex yet, so maybe I'll continue pursuing this direction.
@Path("/collections")
public class CollectionsResource {
/* The "GET" annotation indicates this method will respond to HTTP Get requests. The "Produces" annotation indicates the MIME response the method will return. */ @GET @Produces(MediaType.TEXT_HTML) public String list() { StringBuilder everything = new StringBuilder(); try { Context context = new Context();
Collection[] collections = Collection.findAll(context); for(Collection collection : collections) { everything.append(collection.getName() + "<br/>\n"); }
} catch (SQLException e) { return "ERROR: " + e.getMessage(); }
return "<html><title>Hello!</title><body>Collections<br/>" + everything.toString() + ".</body></html> "; }