Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package uk.co.optimisticpanda.atom.reader;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
 
A feed reader that uses jersey to request feeds over http.
public class JerseyAtomFeedReader implements FeedReader {
    private static final Logger log = LoggerFactory.getLogger(JerseyAtomFeedReader.class);
    private final Client client;
    public JerseyAtomFeedReader(Client client) {
        checkNotNull(client"Client can not be null!");
        this. = client;
    }

    
Note only supports Http urls.
    public Feed load(String link) {
        .info("loading feed from " + link);
        return .resource(link).get(Feed.class);
    }
    public Optional<FeedgetNextArchive(Feed feed) {
        if (feed.getLink("next-archive") == null) {
            return Optional.absent();
        }
        String nextLink = feed.getLink("next-archive").getHref().toString();
        return Optional.of(load(nextLink));
    }
    public Optional<FeedgetPreviousArchive(Feed feed) {
        if (feed.getLink("prev-archive") == null) {
            return Optional.absent();
        }
        String nextLink = feed.getLink("prev-archive").getHref().toString();
        return Optional.of(load(nextLink));
    }
New to GrepCode? Check out our FAQ X