* Json
*/
@GET
@Produces( {MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON})
public SyndFeed getBookmarks(@Context LinkBuilders linkBuilders, @Context UriInfo uriInfo) {
SyndFeed feed = new SyndFeed();
feed.setId("urn:collection:bookmarks");
feed.setTitle(new SyndText("My Bookmarks"));
feed.setUpdated(new Date());
feed.setBase(uriInfo.getAbsolutePath().toString());
// add entries to the feed, based on the existing bookmarks in the
// memory store
// (feed entries have no content, they have just metadata so there is no
// need to set content
// here)
Map<String, String> bookmarks = BookmarkStore.getInstance().getBookmarks();
SystemLinksBuilder entryLinksBuilder = linkBuilders.createSystemLinksBuilder();
for (String key : bookmarks.keySet()) {
// set the sub-resource state of the builder for this entry
entryLinksBuilder.subResource(key);
SyndEntry entry = createEntry(key, bookmarks.get(key), entryLinksBuilder, null);
feed.addEntry(entry);
}
// generate collection links in the response
linkBuilders.createSystemLinksBuilder().build(feed.getLinks());
return feed;
}