protected SyndicationFeed getResults(Context context, String format, String query, int totalResults, int start, int pageSize, DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels) { // Encode results in requested format if ("rss".equals(format)) { format = "rss_2.0"; } else if ("atom".equals(format)) { format = "atom_1.0"; } SyndicationFeed feed = new SyndicationFeed(labels.get(SyndicationFeed.MSG_UITYPE)); feed.populate(null, context, scope, results, labels); feed.setType(format); feed.addModule(openSearchMarkup(query, totalResults, start, pageSize)); return feed; }
@Override public Document getResultsDoc(Context context, String format, String query, int totalResults, int start, int pageSize, DSpaceObject scope, List<DSpaceObject> results, Map<String, String> labels) throws IOException { try { return getResults(context, format, query, totalResults, start, pageSize, scope, results, labels) .outputW3CDom(); } catch (FeedException e) { log.error(e.toString(), e); throw new IOException("Unable to generate feed", e); } }
private Map<String, String> getLocaleLabels(Locale locale) { Map<String, String> labelMap = new HashMap<String, String>(); ResourceBundle labels = ResourceBundle.getBundle("Messages", locale); labelMap.put(SyndicationFeed.MSG_UNTITLED, labels.getString(msgKey + ".notitle")); labelMap.put(SyndicationFeed.MSG_LOGO_TITLE, labels.getString(msgKey + ".logo.title")); labelMap.put(SyndicationFeed.MSG_FEED_DESCRIPTION, labels.getString(msgKey + ".general-feed.description")); labelMap.put(SyndicationFeed.MSG_UITYPE, SyndicationFeed.UITYPE_JSPUI); for (String selector : SyndicationFeed.getDescriptionSelectors()) { labelMap.put("metadata." + selector, labels.getString(SyndicationFeed.MSG_METADATA + selector)); } return labelMap; } }
labelMap.put(SyndicationFeed.MSG_FEED_DESCRIPTION, msgs.getString(clazz + ".general-feed.description")); labelMap.put(SyndicationFeed.MSG_UITYPE, SyndicationFeed.UITYPE_JSPUI); for (String selector : SyndicationFeed.getDescriptionSelectors()) feed = new SyndicationFeed(SyndicationFeed.UITYPE_JSPUI); feed.populate(request, dso, getItems(context, dso), labelMap); if (feedCache != null) feed.setType(feedType); response.setContentType("text/xml; charset=UTF-8"); feed.output(response.getWriter());
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);
feed.setDescription(localize(labels, MSG_FEED_DESCRIPTION)); objectURL = resolveURL(request, null); logoURL = ConfigurationManager.getProperty("webui.feed.logo.url"); } else { objectURL = resolveURL(request, dso); if (logo != null) { logoURL = urlOfBitstream(request, logo); localize(labels, MSG_FEED_TITLE) : defaultTitle); feed.setLink(objectURL); feed.setPublishedDate(new Date()); image.setTitle(feed.getTitle()); } else { image.setTitle(localize(labels, MSG_LOGO_TITLE)); String entryURL = resolveURL(request, item); entry.setLink(entryURL); entry.setUri(entryURL); String title = getOneDC(item, titleField); entry.setTitle(title == null ? localize(labels, MSG_UNTITLED) : title); String pubDate = getOneDC(item, dateField); if (pubDate != null) { entry.setPublishedDate((new DCDate(pubDate)).toDate()); enc.setType(bit.getFormat(context).getMIMEType());