Examples of Feed


Examples of org.b3log.solo.model.feed.atom.Feed

    @RequestProcessing(value = {"/blog-articles-feed.do"}, method = {HTTPRequestMethod.GET, HTTPRequestMethod.HEAD})
    public void blogArticlesAtom(final HTTPRequestContext context) {
        final AtomRenderer renderer = new AtomRenderer();
        context.setRenderer(renderer);

        final Feed feed = new Feed();
        try {
            final JSONObject preference = preferenceQueryService.getPreference();

            final String blogTitle = preference.getString(Preference.BLOG_TITLE);
            final String blogSubtitle = preference.getString(Preference.BLOG_SUBTITLE);
            final String blogHost = preference.getString(Preference.BLOG_HOST);

            feed.setTitle(StringEscapeUtils.escapeXml(blogTitle));
            feed.setSubtitle(StringEscapeUtils.escapeXml(blogSubtitle));
            feed.setUpdated(TimeZones.getTime(preference.getString(Preference.TIME_ZONE_ID)));
            feed.setAuthor(StringEscapeUtils.escapeXml(blogTitle));
            feed.setLink("http://" + blogHost + "/blog-articles-feed.do");
            feed.setId("http://" + blogHost + "/");

            final Query query = new Query().setCurrentPageNum(1).
                    setPageSize(ENTRY_OUTPUT_CNT).
                    addFilter(Article.ARTICLE_IS_PUBLISHED, FilterOperator.EQUAL, true).
                    addSort(Article.ARTICLE_UPDATE_DATE, SortDirection.DESCENDING).
                    setPageCount(1);

            final boolean hasMultipleUsers = Users.getInstance().hasMultipleUsers();
            String authorName = "";

            final JSONObject articleResult = articleRepository.get(query);
            final JSONArray articles = articleResult.getJSONArray(Keys.RESULTS);

            if (!hasMultipleUsers && 0 != articles.length()) {
                authorName = articleUtils.getAuthor(articles.getJSONObject(0)).getString(User.USER_NAME);
            }

            final boolean isFullContent = "fullContent".equals(preference.getString(Preference.FEED_OUTPUT_MODE));

            for (int i = 0; i < articles.length(); i++) {
                final JSONObject article = articles.getJSONObject(i);
                final Entry entry = new Entry();
                feed.addEntry(entry);
                final String title = StringEscapeUtils.escapeXml(article.getString(Article.ARTICLE_TITLE));
                entry.setTitle(title);
                final String summary = isFullContent ? StringEscapeUtils.escapeXml(article.getString(Article.ARTICLE_CONTENT))
                                       : StringEscapeUtils.escapeXml(article.optString(Article.ARTICLE_ABSTRACT));
                entry.setSummary(summary);
                final Date updated = (Date) article.get(Article.ARTICLE_UPDATE_DATE);
                entry.setUpdated(updated);

                final String link = "http://" + blogHost + article.getString(Article.ARTICLE_PERMALINK);
                entry.setLink(link);
                entry.setId(link);

                if (hasMultipleUsers) {
                    authorName = StringEscapeUtils.escapeXml(articleUtils.getAuthor(article).getString(User.USER_NAME));
                }
                entry.setAuthor(authorName);

                final String tagsString = article.getString(Article.ARTICLE_TAGS_REF);
                final String[] tagStrings = tagsString.split(",");
                for (int j = 0; j < tagStrings.length; j++) {
                    final Category catetory = new Category();
                    entry.addCatetory(catetory);
                    final String tag = tagStrings[j];
                    catetory.setTerm(tag);
                }
            }

            renderer.setContent(feed.toString());
        } catch (final Exception e) {
            LOGGER.log(Level.SEVERE, "Get blog article feed error", e);

            try {
                context.getResponse().sendError(
View Full Code Here

Examples of org.brickred.socialauth.Feed

      LOG.debug("Feed Json response :: " + respStr);
      JSONObject resp = new JSONObject(respStr);
      JSONArray data = resp.getJSONArray("data");
      LOG.debug("Feeds count : " + data.length());
      for (int i = 0; i < data.length(); i++) {
        Feed feed = new Feed();
        JSONObject obj = data.getJSONObject(i);
        if (obj.has("images")) {
          JSONObject iobj = obj.getJSONObject("images");
          if (iobj.has("low_resolution")) {
            feed.setMessage(iobj.getJSONObject("low_resolution")
                .optString("url"));
          }
        }
        if (obj.has("user")) {
          JSONObject iobj = obj.getJSONObject("user");
          if (iobj.has("full_name")) {
            feed.setFrom(iobj.getString("full_name"));
          }
          if (iobj.has("id")) {
            feed.setId(iobj.getString("id"));
          }
          if (iobj.has("username")) {
            feed.setScreenName(iobj.getString("username"));
          }
        }
        if (obj.has("created_time")) {
          feed.setCreatedAt(new Date(Integer.parseInt(obj
              .getString("created_time"))));
        }
        list.add(feed);
      }
    } catch (Exception e) {
View Full Code Here

Examples of org.drools.guvnor.server.jaxrs.providers.atom.Feed

    @GET
    @Path("{categoryPath:.+}/assets")
    @Produces(MediaType.APPLICATION_ATOM_XML)
    public Feed getAssetsAsAtom(@PathParam("categoryPath") String categoryPath) {
        Feed f = new Feed();
        f.setTitle(categoryPath);
        AssetItemPageResult result = rulesRepository.findAssetsByCategory(
                categoryPath, 0, pageSize);
        List<AssetItem> assets = result.assets;
        for (AssetItem item : assets) {
            Entry e = toAssetEntryAbdera(item, uriInfo);
            f.getEntries().add(e);
        }

        if (result.hasNext) {
            Link l = new Link();
            l.setRel("next-page");
            l.setHref(uriInfo.getBaseUriBuilder()
                    .path("categories/{categoryPath}/assets//page/{pageNumber}")
                    .build(categoryPath, (Integer) 1));
            f.getLinks().add(l);
        }

        return f;
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.stream.plugins.Feed

     */
    @Test
    public void performActionWithSuccess() throws Exception
    {
        final FeedSubscriber feedSub = context.mock(FeedSubscriber.class);
        final Feed feed = context.mock(Feed.class);
        final HashMap<String, Serializable> conf = new HashMap<String, Serializable>();

        final HashMap<String, Serializable> values = new HashMap<String, Serializable>();
        values.put("EUREKA:TOS", Boolean.TRUE);
        values.put("EUREKA:PLUGINID", 1L);
View Full Code Here

Examples of org.intabulas.sandler.elements.Feed

        try
        {
            if( blogid == null )
            {
                Feed feed = listBlogs();

                response.setContentType("application/x.atom+xml; charset=UTF-8");
                response.getWriter().println( Sandler.marshallFeed(feed) );

                response.getWriter().flush();
View Full Code Here

Examples of org.jboss.resteasy.plugins.providers.atom.Feed

      int status = client.executeMethod(get);
      Assert.assertEquals(200, status);
      System.out.println(get.getResponseBodyAsString());

      AtomServerInterface intf = createProxy(AtomServerInterface.class);
      Feed feed = intf.postFeed(RFC_COMPLEX_XML);
      assertFeed(feed);

      // Thread.sleep(1000000);

   }
View Full Code Here

Examples of org.jboss.seam.wiki.core.model.Feed

            SyndFeedInput input = new SyndFeedInput();
            SyndFeed syndFeed = input.build(new XmlReader(feedSource));

            log.debug("starting conversion from feed URL: " + feedURL);

            Feed feed = convertSyndFeed(syndFeed);

            for (Object o : syndFeed.getEntries()) {
                SyndEntry syndEntry = (SyndEntry)o;
                FeedEntry fe = convertSyndEntry(syndEntry);

                // Append some information on the title
                fe.setTitlePrefix("(" + feed.getTitle() + ") ");
                //fe.setTitleSuffix(" (" + fe.getAuthor() + ")");

                // Linking it in our model makes it persistable/cachable
                feed.getFeedEntries().add(fe);

                // Now project them so the client has a unified view without iterating collections of Feeds
                FeedEntryDTO dto = new FeedEntryDTO(feed, fe);
                feedEntryDTOs.add(dto);
            }
View Full Code Here

Examples of org.olat.modules.webFeed.models.Feed

      long lastResponseMs = request.getDateHeader("If-Modified-Since");
      Date lastResponse = null;
      if (lastResponseMs != -1) {
        lastResponse = new Date(lastResponseMs);
      }
      Feed feedLight = manager.getFeedLigth(feed);
      Date lastModified = null;
      if (feedLight != null) {
        lastModified = feedLight.getLastModified();
      }
      if (lastResponse != null && lastResponse.before(lastModified)) {
        // Send not modified response
        response.setDateHeader("last-modified", lastModified.getTime());
        try {
View Full Code Here

Examples of org.restlet.ext.atom.Feed

public class ConverterTestCase extends RestletTestCase {

    public void testObjectToRepresentation() {
        ConverterService cs = new ConverterService();
        Feed feed = new Feed();
        Representation representation = cs.toRepresentation(feed);
        assertEquals(MediaType.APPLICATION_ATOM, representation.getMediaType());
    }
View Full Code Here

Examples of org.rssowl.core.internal.persist.Feed

   *
   * @throws Exception
   */
  @Test
  public void testSaveNewsSetsCurrentAndOldState() throws Exception {
    IFeed feed = new Feed(new URI("http://www.feed.com"));
    feed = DynamicDAO.save(feed);

    INews news = fFactory.createNews(null, feed, new Date());
    news.setTitle("News Title #1");
    news.setLink(new URI("http://www.link.com"));
    news.setState(INews.State.UNREAD);

    final ICategory category = fFactory.createCategory(null, news);
    category.setName("Category name");

    final IAttachment attachment = fFactory.createAttachment(null, news);
    attachment.setLink(new URI("http://attachment.com"));

    feed = DynamicDAO.save(feed);

    final INews savedNews = feed.getNews().get(0);
    savedNews.setTitle("News Title Updated #1");

    Collection<INews> newsList = new ArrayList<INews>();
    newsList.add(savedNews);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.