Package com.commafeed.frontend.model

Examples of com.commafeed.frontend.model.FeedInfo


    }
    return Response.ok(writer.toString()).build();
  }

  private FeedInfo fetchFeedInternal(String url) {
    FeedInfo info = null;
    url = StringUtils.trimToEmpty(url);
    url = prependHttp(url);
    try {
      FetchedFeed feed = feedFetcher.fetch(url, true, null, null, null, null);
      info = new FeedInfo();
      info.setUrl(feed.getUrlAfterRedirect());
      info.setTitle(feed.getTitle());

    } catch (Exception e) {
      log.debug(e.getMessage(), e);
      throw new WebApplicationException(e, Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build());
    }
View Full Code Here


  @ApiOperation(value = "Fetch a feed", notes = "Fetch a feed by its url", response = FeedInfo.class)
  public Response fetchFeed(@SecurityCheck User user, @ApiParam(value = "feed url", required = true) FeedInfoRequest req) {
    Preconditions.checkNotNull(req);
    Preconditions.checkNotNull(req.getUrl());

    FeedInfo info = null;
    try {
      info = fetchFeedInternal(req.getUrl());
    } catch (Exception e) {
      return Response.status(Status.INTERNAL_SERVER_ERROR).entity(Throwables.getStackTraceAsString(Throwables.getRootCause(e)))
          .build();
View Full Code Here

      FeedCategory category = null;
      if (req.getCategoryId() != null && !CategoryREST.ALL.equals(req.getCategoryId())) {
        category = feedCategoryDAO.findById(Long.valueOf(req.getCategoryId()));
      }
      FeedInfo info = fetchFeedInternal(url);
      feedSubscriptionService.subscribe(user, info.getUrl(), req.getTitle(), category);
    } catch (Exception e) {
      log.error("Failed to subscribe to URL {}: {}", url, e.getMessage(), e);
      return Response.status(Status.SERVICE_UNAVAILABLE).entity("Failed to subscribe to URL " + url + ": " + e.getMessage()).build();
    }
    return Response.ok().build();
View Full Code Here

      Preconditions.checkNotNull(url);

      url = prependHttp(url);
      url = fetchFeedInternal(url).getUrl();

      FeedInfo info = fetchFeedInternal(url);
      feedSubscriptionService.subscribe(user, info.getUrl(), info.getTitle(), null);
    } catch (Exception e) {
      log.info("Could not subscribe to url {} : {}", url, e.getMessage());
    }
    return Response.temporaryRedirect(URI.create(config.getApplicationSettings().getPublicUrl())).build();
  }
View Full Code Here

TOP

Related Classes of com.commafeed.frontend.model.FeedInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.