本文整理了Java中com.sun.syndication.feed.WireFeed
类的一些代码示例,展示了WireFeed
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WireFeed
类的具体详情如下:
包路径:com.sun.syndication.feed.WireFeed
类名称:WireFeed
[英]Parent class of the RSS (Channel) and Atom (Feed) feed beans.
NOTE: We don't like this class at this package level but the alternative would have been a proliferation of packages (one more level to hold atom and rss package with this class just in that package).
The format of the 'type' property must be [FEEDNAME]_[FEEDVERSION] with the FEEDNAME in lower case, for example: rss_0.9, rss_0.93, atom_0.3
[中]RSS(通道)和Atom(提要)提要bean的父类。
注意:我们不喜欢在这个包级别上使用这个类,但另一种选择是包的激增(再增加一个级别,将这个类的atom和rss包放在那个包中)。
“type”属性的格式必须是[FEEDNAME][FEEDVERSION],FEEDNAME的大小写为小写,例如:rss_0.9、rss_0.93、atom_0.3
代码示例来源:origin: rome/rome
/**
* After we parse the feed we put "rss_2.0" in it (so converters and generators work)
* this parser is a phantom.
*
*/
protected WireFeed parseChannel(Element rssRoot) {
WireFeed wFeed = super.parseChannel(rssRoot);
wFeed.setFeedType("rss_2.0");
return wFeed;
}
代码示例来源:origin: com.bbossgroups/bboss-mvc
@Override
protected final void renderMergedOutputModel(
Map<String, Object> model, HttpServletRequest request, HttpServletResponse response)
throws Exception {
T wireFeed = newFeed();
buildFeedMetadata(model, wireFeed, request);
buildFeedEntries(model, wireFeed, request, response);
response.setContentType(getContentType());
if (!StringUtil.hasText(wireFeed.getEncoding())) {
wireFeed.setEncoding("UTF-8");
}
WireFeedOutput feedOutput = new WireFeedOutput();
ServletOutputStream out = response.getOutputStream();
feedOutput.output(wireFeed, new OutputStreamWriter(out, wireFeed.getEncoding()));
out.flush();
}
代码示例来源:origin: rome/rome
/**
* Creates a SyndFeedImpl and populates all its properties out of the
* given RSS Channel or Atom Feed properties, while optionally preserving
* the WireFeed for access via the orignalWireFeed() method.
*
* @param feed
* @param preserveWireFeed
*/
public SyndFeedImpl(WireFeed feed, boolean preserveWireFeed) {
this(SyndFeed.class,IGNORE_PROPERTIES);
if (preserveWireFeed) {
this.wireFeed = feed;
this.preserveWireFeed = preserveWireFeed;
}
if (feed!=null) {
_feedType = feed.getFeedType();
Converter converter = CONVERTERS.getConverter(_feedType);
if (converter==null) {
throw new IllegalArgumentException("Invalid feed type ["+_feedType+"]");
}
converter.copyInto(feed,this);
}
}
代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication
/**
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* <p>
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
public boolean equals(Object other) {
if (other == null) {
return false;
}
// can't use foreign markup in equals, due to JDOM equals impl
Object fm = getForeignMarkup();
setForeignMarkup(((WireFeed)other).getForeignMarkup());
boolean ret = _objBean.equals(other);
// restore foreign markup
setForeignMarkup(fm);
return ret;
}
代码示例来源:origin: rome/rome
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, syndFeed.isPreservingWireFeed()));
}
}
代码示例来源:origin: rome/rome
/**
* Creates a String with the XML representation for the given WireFeed.
* <p>
* If the feed encoding is not NULL, it will be used in the XML prolog encoding attribute. It is the responsibility
* of the developer to ensure that if the String is written to a character stream the stream charset is the same as
* the feed encoding property.
* <p>
* NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'.
* <p>
* @param feed Abstract feed to create XML representation from. The type of the WireFeed must match
* the type given to the FeedOuptut constructor.
* @param prettyPrint pretty-print XML (true) oder collapsed
* @return a String with the XML representation for the given WireFeed.
* @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match.
* @throws FeedException thrown if the XML representation for the feed could not be created.
*
*/
public String outputString(WireFeed feed, boolean prettyPrint) throws IllegalArgumentException,FeedException {
Document doc = outputJDom(feed);
String encoding = feed.getEncoding();
Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
if (encoding!=null) {
format.setEncoding(encoding);
}
XMLOutputter outputter = new XMLOutputter(format);
return outputter.outputString(doc);
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
if (((List)feed.getForeignMarkup()).size() > 0) {
syndFeed.setForeignMarkup(feed.getForeignMarkup());
代码示例来源:origin: com.atlassian.xwork/atlassian-xwork-core
protected void doExecute(String finalDestination, ActionInvocation actionInvocation) throws Exception {
// No need to create a session for RSS
ServletActionContext.getRequest().getSession(false);
HttpServletResponse response = ServletActionContext.getResponse();
if (finalDestination.startsWith("rss"))
response.setContentType("application/rss+xml; charset=" + DEFAULT_DEFAULT_ENCODING);
else if (finalDestination.startsWith("atom"))
response.setContentType("application/atom+xml; charset=" + DEFAULT_DEFAULT_ENCODING);
else
response.setContentType("text/xml; charset=" + DEFAULT_DEFAULT_ENCODING);
SyndFeed feed = (SyndFeed) actionInvocation.getStack().findValue("syndFeed");
if (feed == null)
throw new ServletException("Unable to find feed for this action");
WireFeed outFeed = feed.createWireFeed(finalDestination);
outFeed.setEncoding(DEFAULT_DEFAULT_ENCODING);
new WireFeedOutput().output(outFeed, response.getWriter());
try {
response.flushBuffer();
} catch (IOException e) {
log.info("Client aborted (closed the connection) before the rss feed could be returned.");
if (log.isDebugEnabled()) {
log.debug("Error sending rss result to client", e);
}
}
}
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
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, syndFeed.isPreservingWireFeed()));
}
}
代码示例来源:origin: rome/rome
/**
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* <p>
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
public boolean equals(Object other) {
if (other == null) {
return false;
}
// can't use foreign markup in equals, due to JDOM equals impl
Object fm = getForeignMarkup();
setForeignMarkup(((WireFeed)other).getForeignMarkup());
boolean ret = _objBean.equals(other);
// restore foreign markup
setForeignMarkup(fm);
return ret;
}
代码示例来源:origin: rome/rome
/**
* Writes to an Writer the XML representation for the given WireFeed.
* <p>
* If the feed encoding is not NULL, it will be used in the XML prolog encoding attribute. It is the responsibility
* of the developer to ensure the Writer instance is using the same charset encoding.
* <p>
* NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'.
* <p>
* @param feed Abstract feed to create XML representation from. The type of the WireFeed must match
* the type given to the FeedOuptut constructor.
* @param writer Writer to write the XML representation for the given WireFeed.
* @param prettyPrint pretty-print XML (true) oder collapsed
* @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match.
* @throws IOException thrown if there was some problem writing to the Writer.
* @throws FeedException thrown if the XML representation for the feed could not be created.
*
*/
public void output(WireFeed feed,Writer writer,boolean prettyPrint) throws IllegalArgumentException,IOException, FeedException {
Document doc = outputJDom(feed);
String encoding = feed.getEncoding();
Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
if (encoding!=null) {
format.setEncoding(encoding);
}
XMLOutputter outputter = new XMLOutputter(format);
outputter.output(doc,writer);
}
代码示例来源:origin: rome/rome
if (((List)feed.getForeignMarkup()).size() > 0) {
syndFeed.setForeignMarkup(feed.getForeignMarkup());
代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication
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, syndFeed.isPreservingWireFeed()));
}
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
/**
* After we parse the feed we put "rss_2.0" in it (so converters and generators work)
* this parser is a phantom.
*
*/
protected WireFeed parseChannel(Element rssRoot) {
WireFeed wFeed = super.parseChannel(rssRoot);
wFeed.setFeedType("rss_2.0");
return wFeed;
}
代码示例来源:origin: apache/marmotta
/**
* Indicates whether some other object is "equal to" this one as defined by the Object equals() method.
* <p>
* @param other he reference object with which to compare.
* @return <b>true</b> if 'this' object is equal to the 'other' object.
*
*/
@Override
public boolean equals(Object other) {
if (other == null) {
return false;
}
if (!(other instanceof WireFeed)){
return false;
}
// can't use foreign markup in equals, due to JDOM equals impl
Object fm = getForeignMarkup();
setForeignMarkup(((WireFeed)other).getForeignMarkup());
boolean ret = _objBean.equals(other);
// restore foreign markup
setForeignMarkup(fm);
return ret;
}
代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication
/**
* Writes to an Writer the XML representation for the given WireFeed.
* <p>
* If the feed encoding is not NULL, it will be used in the XML prolog encoding attribute. It is the responsibility
* of the developer to ensure the Writer instance is using the same charset encoding.
* <p>
* NOTE: This method delages to the 'Document WireFeedOutput#outputJDom(WireFeed)'.
* <p>
* @param feed Abstract feed to create XML representation from. The type of the WireFeed must match
* the type given to the FeedOuptut constructor.
* @param writer Writer to write the XML representation for the given WireFeed.
* @param prettyPrint pretty-print XML (true) oder collapsed
* @throws IllegalArgumentException thrown if the feed type of the WireFeedOutput and WireFeed don't match.
* @throws IOException thrown if there was some problem writing to the Writer.
* @throws FeedException thrown if the XML representation for the feed could not be created.
*
*/
public void output(WireFeed feed,Writer writer,boolean prettyPrint) throws IllegalArgumentException,IOException, FeedException {
Document doc = outputJDom(feed);
String encoding = feed.getEncoding();
Format format = prettyPrint ? Format.getPrettyFormat() : Format.getCompactFormat();
if (encoding!=null) {
format.setEncoding(encoding);
}
XMLOutputter outputter = new XMLOutputter(format);
outputter.output(doc,writer);
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
/**
* Creates a SyndFeedImpl and populates all its properties out of the
* given RSS Channel or Atom Feed properties, while optionally preserving
* the WireFeed for access via the orignalWireFeed() method.
*
* @param feed
* @param preserveWireFeed
*/
public SyndFeedImpl(WireFeed feed, boolean preserveWireFeed) {
this(SyndFeed.class,IGNORE_PROPERTIES);
if (preserveWireFeed) {
this.wireFeed = feed;
this.preserveWireFeed = preserveWireFeed;
}
if (feed!=null) {
_feedType = feed.getFeedType();
Converter converter = CONVERTERS.getConverter(_feedType);
if (converter==null) {
throw new IllegalArgumentException("Invalid feed type ["+_feedType+"]");
}
converter.copyInto(feed,this);
}
}
代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication
if (((List)feed.getForeignMarkup()).size() > 0) {
syndFeed.setForeignMarkup(feed.getForeignMarkup());
代码示例来源:origin: apache/marmotta
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, syndFeed.isPreservingWireFeed()));
}
}
代码示例来源:origin: com.sun.syndication/com.springsource.com.sun.syndication
/**
* After we parse the feed we put "rss_2.0" in it (so converters and generators work)
* this parser is a phantom.
*
*/
protected WireFeed parseChannel(Element rssRoot) {
WireFeed wFeed = super.parseChannel(rssRoot);
wFeed.setFeedType("rss_2.0");
return wFeed;
}
内容来源于网络,如有侵权,请联系作者删除!