Package org.dspace.app.util

Examples of org.dspace.app.util.SyndicationFeed


                    // The handle is valid but the object is not a container.
                    throw new ResourceNotFoundException("Unable to syndicate DSpace object: "+handle);
                }
            }
       
            SyndicationFeed feed = new SyndicationFeed(SyndicationFeed.UITYPE_XMLUI);
            feed.populate(ObjectModelHelper.getRequest(objectModel),
                          dso, getRecentlySubmittedItems(context,dso), FeedUtils.i18nLabels);
            feed.setType(this.format);
            Document dom = feed.outputW3CDom();
            FeedUtils.unmangleI18N(dom);
            DOMStreamer streamer = new DOMStreamer(contentHandler, lexicalHandler);
            streamer.stream(dom);
        }
        catch (IllegalArgumentException iae)
View Full Code Here


        }

        // Lookup or generate the feed
        // Cache key is handle + locale
        String cacheKey = (handle==null?"site":handle)+"."+locale.toString();
        SyndicationFeed feed = null;
        if (feedCache != null)
        {
                CacheFeed cFeed = (CacheFeed)feedCache.get(cacheKey);
          if (cFeed != null// cache hit, but...
          {
            // Is the feed current?
            boolean cacheFeedCurrent = false;
            if (cFeed.timeStamp + (cacheAge * HOUR_MSECS) < System.currentTimeMillis())
            {
              cacheFeedCurrent = true;
            }
            // Not current, but have any items changed since feed was created/last checked?
            else if ( ! itemsChanged(context, dso, cFeed.timeStamp))
            {
              // no items have changed, re-stamp feed and use it
                cFeed.timeStamp = System.currentTimeMillis();
                cacheFeedCurrent = true;
            }
            if (cacheFeedCurrent)
            {
                                feed = cFeed.access();
            }
          }
        }
       
        // either not caching, not found in cache, or feed in cache not current
        if (feed == null)
        {
                feed = new SyndicationFeed(SyndicationFeed.UITYPE_JSPUI);
                feed.populate(request, dso, getItems(context, dso), labelMap);
          if (feedCache != null)
          {
                        cache(cacheKey, new CacheFeed(feed));
          }
        }
       
        // set the feed to the requested type & return it
        try
        {
                feed.setType(feedType);
          response.setContentType("text/xml; charset=UTF-8");
                feed.output(response.getWriter());
        }
        catch( FeedException fex )
        {
          throw new IOException(fex.getMessage());
        }
View Full Code Here

                    // The handle is valid but the object is not a container.
                    throw new ResourceNotFoundException("Unable to syndicate DSpace object: "+handle);
                }
            }
       
            SyndicationFeed feed = new SyndicationFeed(SyndicationFeed.UITYPE_XMLUI);
            feed.populate(ObjectModelHelper.getRequest(objectModel),
                          dso, getRecentlySubmittedItems(context,dso), FeedUtils.i18nLabels);
            feed.setType(this.format);
            Document dom = feed.outputW3CDom();
            FeedUtils.unmangleI18N(dom);
            DOMStreamer streamer = new DOMStreamer(contentHandler, lexicalHandler);
            streamer.stream(dom);
        }
        catch (IllegalArgumentException iae)
View Full Code Here

        }

        // Lookup or generate the feed
        // Cache key is handle + locale
        String cacheKey = (handle==null?"site":handle)+"."+locale.toString();
        SyndicationFeed feed = null;
        if (feedCache != null)
        {
                CacheFeed cFeed = feedCache.get(cacheKey);
          if (cFeed != null// cache hit, but...
          {
            // Is the feed current?
            boolean cacheFeedCurrent = false;
            if (cFeed.timeStamp + (cacheAge * HOUR_MSECS) < System.currentTimeMillis())
            {
              cacheFeedCurrent = true;
            }
            // Not current, but have any items changed since feed was created/last checked?
            else if ( ! itemsChanged(context, dso, cFeed.timeStamp))
            {
              // no items have changed, re-stamp feed and use it
                cFeed.timeStamp = System.currentTimeMillis();
                cacheFeedCurrent = true;
            }
            if (cacheFeedCurrent)
            {
                                feed = cFeed.access();
            }
          }
        }
       
        // either not caching, not found in cache, or feed in cache not current
        if (feed == null)
        {
                feed = new SyndicationFeed(SyndicationFeed.UITYPE_JSPUI);
                feed.populate(request, dso, getItems(context, dso), labelMap);
          if (feedCache != null)
          {
                        cache(cacheKey, new CacheFeed(feed));
          }
        }
       
        // set the feed to the requested type & return it
        try
        {
                feed.setType(feedType);
          response.setContentType("text/xml; charset=UTF-8");
                feed.output(response.getWriter());
        }
        catch( FeedException fex )
        {
          throw new IOException(fex.getMessage(), fex);
        }
View Full Code Here

TOP

Related Classes of org.dspace.app.util.SyndicationFeed

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.