Package com.uphea.rss

Examples of com.uphea.rss.Feed


  public RssData view() {
    Question latestQuestion = questionService.findQuestionForDate(new JDateTime());
    List<Question> questions = questionService.findPreviousQuestions(latestQuestion, 24);
    questions.add(0, latestQuestion);

    Feed feed = new Feed();
    feed.setTitle("uphea.com");
    feed.setLink("http://uphea.com");
    feed.setDescription("the nice way of asking smart questions");
    feed.setEncoding(StringPool.UTF_8);
    feed.setPublishedDate(DateUtil.toJDateTime(latestQuestion.getDate()));

    for (Question q : questions) {
      FeedEntry entry = new FeedEntry();
      entry.setPublishedDate(DateUtil.toJDateTime(q.getDate()));
      entry.setTitle(Format.textPlain(q.getText()));
      String link = feed.getLink() + "/q/" + q.getDate();
      entry.setLink(link);
      entry.setGuid(link);
      entry.setDescription("What do you think about?");
      feed.addEntry(entry);
    }
    return new RssData(feed);
  }
View Full Code Here


    rssMimeType = MimeTypes.getMimeType("rss");
  }

  @Override
  public void render(ActionRequest request, RssData resultObject) throws Exception {
    Feed feed = resultObject.getFeed();
    FeedWriter feedWriter = new FeedWriter(feed);

    HttpServletResponse response = request.getHttpServletResponse();
    response.setContentType(rssMimeType);
    response.setCharacterEncoding(feed.getEncoding());
    Writer out = null;
    try {
      out = response.getWriter();
      feedWriter.write(out);
    } catch (Exception ex) {
View Full Code Here

TOP

Related Classes of com.uphea.rss.Feed

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.