Package com.sun.syndication.io

Examples of com.sun.syndication.io.SyndFeedInput


        }
    }

    protected List getLastesEntries() {
        List result = new ArrayList();
        SyndFeedInput input = new SyndFeedInput();
        for (int i = 0;i < urls.size();i++) {
            URL inputUrl = (URL) urls.get(i);
            SyndFeed inFeed;
            try {
                inFeed = input.build(new XmlReader(inputUrl));
                List entries = inFeed.getEntries();
                for (int k = 0;k < entries.size();k++) {
                    SyndEntry entry = (SyndEntry) entries.get(k);
                    if (entry.getPublishedDate().after(getLastPolledDate())) {
                        result.add(entry);
View Full Code Here


    String encoding = detector.guessEncoding(content, defaultEncoding);
    try {
      InputSource input = new InputSource(new ByteArrayInputStream(content
          .getContent()));
      input.setEncoding(encoding);
      SyndFeedInput feedInput = new SyndFeedInput();
      feed = feedInput.build(input);
    } catch (Exception e) {
      // return empty parse
      LOG.warn("Parse failed: url: " + content.getUrl() + ", exception: "
          + StringUtils.stringifyException(e));
      return new ParseStatus(e)
View Full Code Here

    this.name = name;
  }

  @SuppressWarnings("unchecked")
  public void parse() throws Exception {
    SyndFeedInput input = new SyndFeedInput();
    byte b[] = downloadAndSendBinary(url);
    if (b != null) {
      SyndFeed feed = input.build(new XmlReader(new ByteArrayInputStream(b)));
      name = feed.getTitle();
      if (feed.getCategories() != null && feed.getCategories().size() > 0) {
        SyndCategory category = (SyndCategory) feed.getCategories().get(0);
        tempCategory = category.getName();
      }
View Full Code Here

    final Response response =
        RequestFacade.sendMessage(FEED_URL_PART + feedId + sb.toString(), Method.GET);
    final String text = response.getEntity().getText();
    Assert.assertTrue("Unexpected response: " + text, response.getStatus().isSuccess());

    return new SyndFeedInput().build(new XmlReader(new ByteArrayInputStream(text.getBytes())));
  }
View Full Code Here

            Thread.currentThread().setContextClassLoader(getClass()
                    .getClassLoader());
            c = getGmailConnection();
            c.setUrl(gmailFeedUrl);
            final URLConnection con = c.openConnection();
            final SyndFeedInput feedInput = new SyndFeedInput();
            final SyndFeed gmail = feedInput.build(new XmlReader(con));
            for (final Object entry : gmail.getEntries()) {
                if (entry instanceof SyndEntry) {
                    messages.add(new RssGmailMessage((SyndEntry) entry));
                }
            }
View Full Code Here

    private static final Logger LOG = Logger.getLogger(RomeFeedExecuter.class);

    public Feed getFeed(URL url) throws FeedException, IOException {
        Feed f = null;
        final SyndFeedInput input = new SyndFeedInput();
        try {
            final SyndFeed romeFeed = input.build(
                    new XmlReader(HttpUtil.getConnectionStream(url, options)));
            f = new Feed();
            f.setTitle(romeFeed.getTitle());
            String link = romeFeed.getLink();
            if (link != null) {
View Full Code Here

     
      httpSource.setConnectTimeout(Constants.HTTP_TIMEOUT);
      httpSource.setReadTimeout(Constants.HTTP_TIMEOUT);
      httpSource.addRequestProperty("User-Agent", Constants.HTTP_USERAGENT);
     
      SyndFeedInput input = new SyndFeedInput();
      XmlReader reader = new XmlReader(httpSource);

      this.feed = input.build(reader);
      this.size = feed.getEntries().size();
      setLoaded(true);

    } catch (MalformedURLException e) {
      StoryReaderException sre=new StoryReaderException(Constants.EXCEPTION_INVALID_URL + ": "+ e.getMessage());
View Full Code Here

   * @param maxSize      max size
   * @param includeReply if including reply
   * @return {@link PanelEntry} list
   */
  public List<PanelEntry> getPanelEntries(String feedURL, int maxSize, boolean includeReply) {
    SyndFeedInput input = new SyndFeedInput();
    XmlReader reader = null;
    HttpURLConnection feedConnection = null;
    try {
      List<PanelEntry> panelEntries = new ArrayList<PanelEntry>();
      URL url = new URL(feedURL);
      feedConnection = (HttpURLConnection) url.openConnection();
      feedConnection.setConnectTimeout(4000);
      feedConnection.setReadTimeout(4000);
      reader = new XmlReader(feedConnection);
      SyndFeed feed = input.build(reader);
      int count = 0;
      for (Object eachObj : feed.getEntries()) {
        SyndEntryImpl each = cast(eachObj);
        if (!includeReply && StringUtils.startsWithIgnoreCase(each.getTitle(), "Re: ")) {
          continue;
View Full Code Here

    String encoding = detector.guessEncoding(content, defaultEncoding);
    try {
      InputSource input = new InputSource(new ByteArrayInputStream(content
          .getContent()));
      input.setEncoding(encoding);
      SyndFeedInput feedInput = new SyndFeedInput();
      feed = feedInput.build(input);
    } catch (Exception e) {
      // return empty parse
      LOG.warn("Parse failed: url: " + content.getUrl() + ", exception: "
          + StringUtils.stringifyException(e));
      return new ParseStatus(e)
View Full Code Here

   */
  //@SuppressWarnings("unchecked")
  public JSONObject process(String feedUrl, String feedXml, boolean getSummaries, int numEntries)
      throws GadgetException {
    try {
      SyndFeed feed = new SyndFeedInput().build(new StringReader(feedXml));
      JSONObject json = new JSONObject();
      json.put("Title", Strings.nullToEmpty(feed.getTitle()));
      json.put("URL", feedUrl);
      json.put("Description", Strings.nullToEmpty(feed.getDescription()));
      json.put("Link", Strings.nullToEmpty(feed.getLink()));
View Full Code Here

TOP

Related Classes of com.sun.syndication.io.SyndFeedInput

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.