Ejemplo n.º 1
0
  protected void buildFeedMetadata(
      Map<String, Object> model, Feed feed, HttpServletRequest request) {
    Blog blog = blogService.readBlogById(Blog.DEFAULT_ID);
    String language = LocaleContextHolder.getLocale().getLanguage();

    feed.setTitle(blog.getTitle(language));
    Content info = new Content();
    info.setValue(blog.getTitle(language));
    feed.setInfo(info);

    ArrayList<Link> links = new ArrayList<>();
    Link link = new Link();
    UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
    link.setHref(builder.buildAndExpand().toUriString());
    links.add(link);
    feed.setOtherLinks(links);
    //		feed.setIcon("http://" + settings.getAsString(Setting.Key.SITE_URL) +
    // "resources/default/img/favicon.ico");
  }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  @Override
  protected List<Entry> buildFeedEntries(
      Map<String, Object> model, HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    Set<Article> articles = (Set<Article>) model.get("articles");
    List<Entry> entries = new ArrayList<>(articles.size());
    for (Article article : articles) {
      Entry entry = new Entry();
      entry.setTitle(article.getTitle());
      entry.setPublished(article.getDate().toDate());
      Content content = new Content();
      content.setValue(article.getBody());
      entry.setSummary(content);

      Link link = new Link();
      link.setHref(link(article));
      List<Link> links = new ArrayList<Link>();
      links.add(link);
      entry.setAlternateLinks(links);
      entries.add(entry);
    }
    return entries;
  }