use of co.cask.cdap.notifications.feeds.NotificationFeedNotFoundException in project cdap by caskdata.
the class NotificationFeedHttpHandler method getFeed.
@GET
@Path("/feeds/categories/{feed-category}/names/{feed-name}")
public void getFeed(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("feed-category") String category, @PathParam("feed-name") String name) {
try {
NotificationFeedId feed;
try {
feed = new NotificationFeedId(namespaceId, category, name);
} catch (IllegalArgumentException e) {
responder.sendString(HttpResponseStatus.BAD_REQUEST, e.getMessage());
return;
}
responder.sendJson(HttpResponseStatus.OK, GSON.toJson(feedManager.getFeed(feed)));
} catch (NotificationFeedNotFoundException e) {
responder.sendStatus(HttpResponseStatus.NOT_FOUND);
} catch (NotificationFeedException e) {
responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, String.format("Could not check subscribe permission for Notification Feed. %s", e.getMessage()));
} catch (Throwable t) {
LOG.debug("Error in getting notification feed.", t);
responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR, t.getMessage());
}
}
Aggregations