本文整理匯總了Java中com.sun.syndication.feed.synd.SyndFeed.setDescription方法的典型用法代碼示例。如果您正苦於以下問題:Java SyndFeed.setDescription方法的具體用法?Java SyndFeed.setDescription怎麽用?Java SyndFeed.setDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.syndication.feed.synd.SyndFeed
的用法示例。
在下文中一共展示了SyndFeed.setDescription方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: copyInto
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
syndFeed.setEncoding(feed.getEncoding());
Channel channel = (Channel) feed;
syndFeed.setTitle(channel.getTitle());
syndFeed.setLink(channel.getLink());
syndFeed.setDescription(channel.getDescription());
Image image = channel.getImage();
if (image!=null) {
syndFeed.setImage(createSyndImage(image));
}
List items = channel.getItems();
if (items!=null) {
syndFeed.setEntries(createSyndEntries(items));
}
}
示例2: getAllBuildsFeed
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
* Returns a feed for all builds that are allowed for a given user.
*
* @param userID for that to return feeds.
*
* @return a feed for all builds that are allowed for the given user.
*/
public SyndFeed getAllBuildsFeed(final int userID) {
final List buildStatusList = org.parabuild.ci.security.SecurityManager.getInstance().getFeedBuildStatuses(userID);
// traverse build statuses
final List entries = new ArrayList(11);
final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
final ConfigurationManager cm = ConfigurationManager.getInstance();
for (final Iterator i = buildStatusList.iterator(); i.hasNext();) {
final int activeBuildID = ((BuildState)i.next()).getActiveBuildID();
entries.addAll(getBuildEntries(cm, activeBuildID, urlGenerator));
}
// create feed and set collected entries
final SyndFeed feed = new SyndFeedImpl();
feed.setTitle("Parabuild Published Result Feed");
feed.setLink(urlGenerator.makeBuildListURL());
feed.setDescription("This feed provides information about published results at Parabuild server");
feed.setEntries(entries);
// return result
return feed;
}
示例3: getAllBuildsFeed
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
* Returns a feed for all builds that are allowed for a given user.
*
* @param userID for that to return feeds.
* @return a feed for all builds that are allowed for the given user.
*/
public SyndFeed getAllBuildsFeed(final int userID) {
final List buildStatusList = SecurityManager.getInstance().getFeedBuildStatuses(userID);
// traverse build statuses
final List entries = new ArrayList(1);
final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
final ConfigurationManager cm = ConfigurationManager.getInstance();
for (final Iterator i = buildStatusList.iterator(); i.hasNext();) {
final int activeBuildID = ((BuildState) i.next()).getActiveBuildID();
entries.addAll(getBuildEntries(cm, activeBuildID, urlGenerator));
}
// create feed and set collected entries
final SyndFeed feed = new SyndFeedImpl();
feed.setTitle("Parabuild Feed");
feed.setLink(urlGenerator.makeBuildListURL());
feed.setDescription("This feed provides information about build statuses at Parabuild server");
feed.setEntries(entries);
// return result
return feed;
}
示例4: generateFeed
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public SyndFeed generateFeed( String title, String description, List<RssFeedEntry> dataEntries )
{
if( dataEntries.size() == 0 )
{
log.debug( "No updates found, feed not generated." );
return null;
}
SyndFeed feed = new SyndFeedImpl();
feed.setTitle( title );
feed.setDescription( description );
feed.setLanguage( DEFAULT_LANGUAGE );
feed.setPublishedDate( dataEntries.get( dataEntries.size() - 1 ).getPublishedDate() );
feed.setFeedType( DEFAULT_FEEDTYPE );
feed.setEntries( getEntries( dataEntries ) );
log.debug( "Finished generating the feed \'{}\'.", title );
return feed;
}
示例5: doGet
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType("rss_2.0");
feed.setTitle("WildFly-Camel Test RSS Feed");
feed.setLink("http://localhost:8080/rss-tests");
feed.setDescription("Test RSS feed for the camel-rss component");
List<SyndEntry> entries = new ArrayList<>();
for (int i = 1; i <= 5; i++) {
entries.add(createFeedEntry("Test entry: ", "Test content: ", i));
}
feed.setEntries(entries);
SyndFeedOutput output = new SyndFeedOutput();
try {
output.output(feed, response.getWriter());
} catch (FeedException e) {
throw new IllegalStateException("Error generating RSS feed", e);
}
}
示例6: copyInto
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
syndFeed.setModules(ModuleUtils.cloneModules(feed.getModules()));
if (((List)feed.getForeignMarkup()).size() > 0) {
syndFeed.setForeignMarkup(feed.getForeignMarkup());
}
syndFeed.setEncoding(feed.getEncoding());
Channel channel = (Channel) feed;
syndFeed.setTitle(channel.getTitle());
syndFeed.setLink(channel.getLink());
syndFeed.setDescription(channel.getDescription());
Image image = channel.getImage();
if (image!=null) {
syndFeed.setImage(createSyndImage(image));
}
List items = channel.getItems();
if (items!=null) {
syndFeed.setEntries(createSyndEntries(items));
}
}
示例7: getBuildFeed
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
* Returns a feed for all builds that are allowed for a given user.
*
* @param userID for that to return feeds.
*
* @return a feed for all builds that are allowed for the given user.
*/
public SyndFeed getBuildFeed(final int userID, final int activeBuildID) throws AccessForbiddenException, FeedNotFoundException {
// validate that a build exists
final ConfigurationManager cm = ConfigurationManager.getInstance();
final ActiveBuildConfig activeBuildConfig = cm.getActiveBuildConfig(activeBuildID);
if (activeBuildConfig == null) {
throw new FeedNotFoundException("Requested feed not found");
}
// validat build access
if (!SystemConfigurationManagerFactory.getManager().isAnonymousAccessToProtectedFeedsIsEnabled()) {
final SecurityManager securityManager = SecurityManager.getInstance();
if (!securityManager.userCanViewBuild(userID, activeBuildID)) {
throw new AccessForbiddenException("Access to this feed is forbidden");
}
}
final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
final String buildName = activeBuildConfig.getBuildName();
final SyndFeed feed = new SyndFeedImpl();
feed.setTitle("Parabuild Feed for " + buildName);
feed.setLink(urlGenerator.makeBuildStatusURL(activeBuildID));
feed.setDescription("This feed provides information about statuses for " + buildName);
feed.setEntries(getBuildEntries(cm, activeBuildID, urlGenerator));
// return result
return feed;
}
示例8: getBuildFeed
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
* Returns a feed for all builds that are allowed for a given user.
*
* @param userID for that to return feeds.
* @return a feed for all builds that are allowed for the given user.
*/
public SyndFeed getBuildFeed(final int userID, final int activeBuildID) throws AccessForbiddenException, FeedNotFoundException {
// validate that a build exists
final ConfigurationManager cm = ConfigurationManager.getInstance();
final ActiveBuildConfig activeBuildConfig = cm.getActiveBuildConfig(activeBuildID);
if (activeBuildConfig == null) {
throw new FeedNotFoundException("Requested feed not found");
}
// validat build access
if (!SystemConfigurationManagerFactory.getManager().isAnonymousAccessToProtectedFeedsIsEnabled()) {
final SecurityManager securityManager = SecurityManager.getInstance();
if (!securityManager.userCanViewBuild(userID, activeBuildID)) {
throw new AccessForbiddenException("Access to this feed is forbidden");
}
}
final BuildStatusURLGenerator urlGenerator = new BuildStatusURLGenerator();
final String buildName = activeBuildConfig.getBuildName();
final SyndFeed feed = new SyndFeedImpl();
feed.setTitle("Parabuild Feed for " + buildName);
feed.setLink(urlGenerator.makeBuildStatusURL(activeBuildID));
feed.setDescription("This feed provides information about statuses for " + buildName);
feed.setEntries(getBuildEntries(cm, activeBuildID, urlGenerator));
// return result
return feed;
}
示例9: makeRSSFromRSSCorresponList
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
* コレポンリストからRSSを生成する.
* @param rssCorresponList コレポンリスト
* @param baseURL BaseURL
* @return RSS
* @throws ServiceAbortException 設定値からRSSを出力する際に例外発生
*/
private String makeRSSFromRSSCorresponList(
List<RSSCorrespon> rssCorresponList, String baseURL) throws ServiceAbortException {
String resultRSS = null;
SyndFeed feed = (SyndFeed) new SyndFeedImpl();
feed.setFeedType(FEED_TYPE);
feed.setTitle(RSS_TITLE);
feed.setLink("");
feed.setDescription("");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
if (rssCorresponList != null) {
for (RSSCorrespon c : rssCorresponList) {
entries.add(makeEntryFromRSSCorrespon(c, baseURL));
}
}
feed.setEntries(entries);
try {
SyndFeedOutput output = new SyndFeedOutput();
resultRSS = output.outputString(feed);
} catch (FeedException e) {
// 設定された値から生成されるXMLが異常だった際に発生. 起こり得ない.
ServiceAbortException sae =
new ServiceAbortException("RSS outputString error");
sae.initCause(e);
throw sae;
}
return resultRSS;
}
示例10: createFeed
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
/**
* @param feedFile
* @param seriesId
* @param title
* @param transcodingProfileId
* @return
*/
public SyndFeed createFeed(File feedFile, String seriesId, String title,
String transcodingProfileId) {
final SyndFeed defaultFeed = new SyndFeedImpl();
defaultFeed.setFeedType("rss_2.0");
defaultFeed.setTitle(title);
defaultFeed.setLink(this.applicationURL + PATH_SEPARATOR + transcodingProfileId
+ PATH_SEPARATOR + seriesId + feedFileExtension);
defaultFeed.setDescription("Feed for the MythTV recordings of this program");
File transformedFeedFile = null;
try {
final File feedDirectory = feedFile.getParentFile();
if (!feedDirectory.exists()) {
feedDirectory.mkdirs();
LOGGER.info("Created feed directory: " + feedDirectory.getPath());
}
FileWriter writer = new FileWriter(feedFile);
SyndFeedOutput output = new SyndFeedOutput();
output.output(defaultFeed, writer);
transformedFeedFile = this.generateTransformationFromFeed(feedFile, defaultFeed, seriesId);
return defaultFeed;
} catch (Exception e) {
LOGGER.error("Error rendering feed", e);
if (feedFile.canWrite()) {
feedFile.delete();
}
if (transformedFeedFile != null && transformedFeedFile.canWrite()) {
transformedFeedFile.delete();
}
return null;
}
}
示例11: rss
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public String rss() throws IOException, FeedException {
SyndFeed feed = new SyndFeedImpl();
feed.setTitle("hiscores.shmup.com");
feed.setFeedType("rss_2.0");
feed.setDescription("hiscores.shmup.com");
feed.setLink("http://hiscores.shmup.com");
List entries = new ArrayList();
feed.setEntries(entries);
for (Score score : scores) {
SyndEntry entry = new SyndEntryImpl();
entry.setTitle(score.getGameTitle());
entry.setAuthor(score.player.name);
entry.setLink("http://hiscores.shmup.com/score/" + score.id);
SyndContentImpl content = new SyndContentImpl();
content.setValue(score.tweet());
entry.setDescription(content);
entry.setPublishedDate(score.getCreatedAt());
entry.setUpdatedDate(score.getCreatedAt());
SyndEnclosureImpl enclosure = new SyndEnclosureImpl();
enclosure.setUrl(score.game.cover);
enclosure.setType(score.game.getCoverType());
entry.setEnclosures(Lists.newArrayList(enclosure));
entries.add(entry);
}
Writer writer = new StringWriter();
SyndFeedOutput output = new SyndFeedOutput();
output.output(feed, writer);
writer.close();
Controller.response().setContentType("application/rss+xml");
return writer.toString();
}
示例12: copyInto
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public void copyInto(WireFeed feed, SyndFeed syndFeed) {
Feed aFeed = (Feed) feed;
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
syndFeed.setEncoding(aFeed.getEncoding());
syndFeed.setUri(aFeed.getId());
syndFeed.setTitle(aFeed.getTitle());
Content aSubtitle = aFeed.getSubtitle();
if (aSubtitle!=null) {
syndFeed.setDescription(aSubtitle.getValue());
}
// if there is exactly one alternate link, use that as THE link
if (aFeed.getAlternateLinks() != null
&& aFeed.getAlternateLinks().size() == 1) {
Link theLink = (Link)aFeed.getAlternateLinks().get(0);
syndFeed.setLink(theLink.getHref());
}
// lump alternate and other links together
List syndLinks = new ArrayList();
if (aFeed.getAlternateLinks() != null
&& aFeed.getAlternateLinks().size() > 0) {
syndLinks.addAll(createSyndLinks(aFeed.getAlternateLinks()));
}
if (aFeed.getOtherLinks() != null
&& aFeed.getOtherLinks().size() > 0) {
syndLinks.addAll(createSyndLinks(aFeed.getOtherLinks()));
}
List aEntries = aFeed.getEntries();
if (aEntries!=null) {
syndFeed.setEntries(createSyndEntries(aFeed, aEntries));
}
// Core Atom language/author/copyright/modified elements have precedence
// over DC equivalent info.
List authors = aFeed.getAuthors();
if (authors!=null && authors.size() > 0) {
syndFeed.setAuthors(ConverterForAtom03.createSyndPersons(authors));
}
String rights = aFeed.getRights();
if (rights!=null) {
syndFeed.setCopyright(rights);
}
Date date = aFeed.getUpdated();
if (date!=null) {
syndFeed.setPublishedDate(date);
}
}
示例13: copyInto
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public void copyInto(WireFeed feed,SyndFeed syndFeed) {
Feed aFeed = (Feed) feed;
syndFeed.setModules(ModuleUtils.cloneModules(aFeed.getModules()));
syndFeed.setEncoding(aFeed.getEncoding());
syndFeed.setUri(aFeed.getId());
syndFeed.setTitle(aFeed.getTitle());
String linkHref = null;
if (aFeed.getAlternateLinks().size() > 0) {
linkHref = ((Link) aFeed.getAlternateLinks().get(0)).getHref();
}
syndFeed.setLink(linkHref);
Content tagline = aFeed.getTagline();
if (tagline!=null) {
syndFeed.setDescription(tagline.getValue());
}
List aEntries = aFeed.getEntries();
if (aEntries!=null) {
syndFeed.setEntries(createSyndEntries(aEntries));
}
// Core Atom language/author/copyright/modified elements have precedence
// over DC equivalent info.
String language = aFeed.getLanguage();
if (language!=null) {
syndFeed.setLanguage(language);
}
List authors = aFeed.getAuthors();
if (authors!=null && authors.size() > 0) {
syndFeed.setAuthors(createSyndPersons(authors));
}
String copyright = aFeed.getCopyright();
if (copyright!=null) {
syndFeed.setCopyright(copyright);
}
Date date = aFeed.getModified();
if (date!=null) {
syndFeed.setPublishedDate(date);
}
}
示例14: main
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public static void main(String[] args) {
boolean ok = false;
if (args.length>=2) {
try {
String outputType = args[0];
SyndFeed aggrFeed = new SyndFeedImpl();
aggrFeed.setFeedType(outputType);
aggrFeed.setTitle("Aggregated Feed");
aggrFeed.setDescription("Anonymous Aggregated Feed");
aggrFeed.setAuthor("anonymous");
aggrFeed.setLink("http://www.anonymous.com");
List entries = new ArrayList();
aggrFeed.setEntries(entries);
for (int i=1;i<args.length;i++) {
URL feedUrl = new URL(args[i]);
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(feedUrl));
entries.addAll(feed.getEntries());
}
SyndFeedOutput output = new SyndFeedOutput();
output.output(aggrFeed,new PrintWriter(System.out));
ok = true;
}
catch (Exception ex) {
System.out.println("ERROR: "+ex.getMessage());
}
}
if (!ok) {
System.out.println();
System.out.println("FeedAggregator aggregates different feeds into a single one.");
System.out.println("The first parameter must be the feed type for the aggregated feed.");
System.out.println(" [valid values are: rss_0.9, rss_0.91, rss_0.92, rss_0.93, ]");
System.out.println(" [ rss_0.94, rss_1.0, rss_2.0 & atom_0.3 ]");
System.out.println("The second to last parameters are the URLs of feeds to aggregate.");
System.out.println();
}
}
示例15: generateBlogRssFeed
import com.sun.syndication.feed.synd.SyndFeed; //導入方法依賴的package包/類
public static Map<String, Object> generateBlogRssFeed(DispatchContext dctx, Map<String, ? extends Object> context) {
GenericValue userLogin = (GenericValue) context.get("userLogin");
String contentId = (String) context.get("blogContentId");
String entryLink = (String) context.get("entryLink");
String feedType = (String) context.get("feedType");
Locale locale = (Locale) context.get("locale");
// create the main link
String mainLink = (String) context.get("mainLink");
mainLink = mainLink + "?blogContentId=" + contentId;
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
// get the main blog content
GenericValue content = null;
try {
content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).queryOne();
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
if (content == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"ContentCannotGenerateBlogRssFeed",
UtilMisc.toMap("contentId", contentId), locale));
}
// create the feed
SyndFeed feed = new SyndFeedImpl();
feed.setFeedType(feedType);
feed.setLink(mainLink);
feed.setTitle(content.getString("contentName"));
feed.setDescription(content.getString("description"));
feed.setEntries(generateEntryList(dispatcher, delegator, contentId, entryLink, locale, userLogin));
Map<String, Object> resp = ServiceUtil.returnSuccess();
resp.put("wireFeed", feed.createWireFeed());
return resp;
}