本文整理汇总了Java中com.rometools.rome.feed.atom.Link.setRel方法的典型用法代码示例。如果您正苦于以下问题:Java Link.setRel方法的具体用法?Java Link.setRel怎么用?Java Link.setRel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.atom.Link
的用法示例。
在下文中一共展示了Link.setRel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFeedMetadata
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
feed.setId("https://github.com/mploed/event-driven-spring-boot/customer");
feed.setTitle("Customer");
List<Link> alternateLinks = new ArrayList<>();
Link link = new Link();
link.setRel("self");
link.setHref(baseUrl(request) + "feed");
alternateLinks.add(link);
List<SyndPerson> authors = new ArrayList<SyndPerson>();
Person person = new Person();
person.setName("Big Pug Bank");
authors.add(person);
feed.setAuthors(authors);
feed.setAlternateLinks(alternateLinks);
feed.setUpdated(customerRepository.lastUpdate());
Content subtitle = new Content();
subtitle.setValue("List of all customers");
feed.setSubtitle(subtitle);
}
示例2: buildFeedMetadata
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
@Override
protected void buildFeedMetadata(Map<String, Object> model, Feed feed, HttpServletRequest request) {
feed.setId("tag:ewolff.com/microservice-atom/order");
feed.setTitle("Order");
List<Link> alternateLinks = new ArrayList<>();
Link link = new Link();
link.setRel("self");
link.setHref(baseUrl(request) + "feed");
alternateLinks.add(link);
List<SyndPerson> authors = new ArrayList<SyndPerson>();
Person person = new Person();
person.setName("Big Money Online Commerce Inc.");
authors.add(person);
feed.setAuthors(authors);
feed.setAlternateLinks(alternateLinks);
feed.setUpdated(orderRepository.lastUpdate());
Content subtitle = new Content();
subtitle.setValue("List of all orders");
feed.setSubtitle(subtitle);
}
示例3: clone
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
@Override
public Object clone() {
final AtomLinkModuleImpl m = new AtomLinkModuleImpl();
List<Link> result = new LinkedList<Link>();
for(Link link : this.getLinks()) {
Link l = new Link();
l.setHref(link.getHref());
l.setType(link.getType());
l.setRel(link.getRel());
l.setHreflang(link.getHreflang());
l.setTitle(link.getTitle());
l.setLength(link.getLength());
result.add(l);
}
links.subList(0, links.size());
m.setLinks(result);
return m;
}
示例4: parseLink
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
private Link parseLink(final Element eLink) {
final Link link = new Link();
final String rel = getAttributeValue(eLink, "rel");
if (rel != null) {
link.setRel(rel);
}
final String type = getAttributeValue(eLink, "type");
if (type != null) {
link.setType(type);
}
final String href = getAttributeValue(eLink, "href");
if (href != null) {
link.setHref(href);
}
return link;
}
示例5: toLink
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
private Link toLink(OPDSLink opdsLinkI) {
Link link = new Link();
link.setHref(opdsLinkI.getHref());
link.setRel(opdsLinkI.getRel());
link.setType(opdsLinkI.getType());
return link;
}
示例6: setAvatar
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
/**
* Set the value of avatar
*
* @param newavatar new value of avatar
*/
public void setAvatar(final Link newavatar) {
final Link old = getAvatar();
if (old != null) {
getOtherLinks().remove(old);
}
newavatar.setRel("avatar");
getOtherLinks().add(newavatar);
}
示例7: setThumbnail
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
/**
* Set the value of thumbnail
*
* @param newthumbnail new value of thumbnail
*/
public void setThumbnail(final Link newthumbnail) {
Link old = null;
for (final Link l : getOtherLinks()) {
if ("thumbnail".equals(l.getRel())) {
old = l;
break;
}
}
if (old != null) {
getOtherLinks().remove(old);
newthumbnail.setRel("thumbnail");
}
getOtherLinks().add(newthumbnail);
}
示例8: copyFrom
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
@Override
public void copyFrom(CopyFrom obj) {
AtomLinkModule other = (AtomLinkModule) obj;
List<Link> links = other.getLinks();
for (Link link : links) {
Link l = new Link();
l.setHref(link.getHref());
l.setType(link.getType());
l.setRel(link.getRel());
l.setHreflang(link.getHreflang());
l.setTitle(link.getTitle());
l.setLength(link.getLength());
this.links.add(l);
}
}
示例9: parseLink
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
private Link parseLink(final Element eLink) {
final Link link = new Link();
final String rel = getAttributeValue(eLink, AtomLinkAttribute.REL);
if (rel != null) {
link.setRel(rel);
}
final String type = getAttributeValue(eLink, AtomLinkAttribute.TYPE);
if (type != null) {
link.setType(type);
}
final String href = getAttributeValue(eLink, AtomLinkAttribute.HREF);
if (href != null) {
link.setHref(href);
}
final String title = getAttributeValue(eLink, AtomLinkAttribute.TITLE);
if (title != null) {
link.setTitle(title);
}
final String hrefLang = getAttributeValue(eLink, AtomLinkAttribute.HREF_LANG);
if (hrefLang != null) {
link.setHreflang(hrefLang);
}
final String length = getAttributeValue(eLink, AtomLinkAttribute.LENGTH);
if (length != null) {
final Long val = NumberParser.parseLong(length);
if (val != null) {
link.setLength(val.longValue());
}
}
return link;
}
示例10: createAtomEnclosure
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
public Link createAtomEnclosure(final SyndEnclosure syndEnclosure) {
final Link link = new Link();
link.setRel("enclosure");
link.setType(syndEnclosure.getType());
link.setHref(syndEnclosure.getUrl());
link.setLength(syndEnclosure.getLength());
return link;
}
示例11: createAtomLink
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
public Link createAtomLink(final SyndLink syndLink) {
final Link link = new Link();
link.setRel(syndLink.getRel());
link.setType(syndLink.getType());
link.setHref(syndLink.getHref());
link.setHreflang(syndLink.getHreflang());
link.setLength(syndLink.getLength());
link.setTitle(syndLink.getTitle());
return link;
}
示例12: createAtomLink
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
public Link createAtomLink(final SyndLink syndLink) {
final Link link = new Link();
link.setRel(syndLink.getRel());
link.setType(syndLink.getType());
link.setHref(syndLink.getHref());
link.setTitle(syndLink.getTitle());
return link;
}
示例13: updateMediaEntryAppLinks
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
private void updateMediaEntryAppLinks(final Entry entry, final String fileName, final boolean singleEntry) {
// TODO: figure out why PNG is missing from Java MIME types
final FileTypeMap map = FileTypeMap.getDefaultFileTypeMap();
if (map instanceof MimetypesFileTypeMap) {
try {
((MimetypesFileTypeMap) map).addMimeTypes("image/png png PNG");
} catch (final Exception ignored) {
}
}
entry.setId(getEntryMediaViewURI(fileName));
entry.setTitle(fileName);
entry.setUpdated(new Date());
final List<Link> otherlinks = new ArrayList<Link>();
entry.setOtherLinks(otherlinks);
final Link editlink = new Link();
editlink.setRel("edit");
editlink.setHref(getEntryEditURI(fileName, relativeURIs, singleEntry));
otherlinks.add(editlink);
final Link editMedialink = new Link();
editMedialink.setRel("edit-media");
editMedialink.setHref(getEntryMediaEditURI(fileName, relativeURIs, singleEntry));
otherlinks.add(editMedialink);
final Content content = entry.getContents().get(0);
content.setSrc(getEntryMediaViewURI(fileName));
final List<Content> contents = new ArrayList<Content>();
contents.add(content);
entry.setContents(contents);
}
示例14: setFeedUrl
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
private void setFeedUrl(String feedPath, Feed feed) {
String feedUrl = siteUrl.getAbsoluteUrl(feedPath);
Link feedLink = new Link();
feedLink.setHref(feedUrl);
feedLink.setRel("self");
feed.setOtherLinks(Arrays.asList(feedLink));
}
示例15: addToCollection
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
void addToCollection(final ClientCollection col) throws ProponoException {
setCollection(col);
final EntityEnclosingMethod method = new PostMethod(getCollection().getHrefResolved());
addAuthentication(method);
final StringWriter sw = new StringWriter();
int code = -1;
try {
Atom10Generator.serializeEntry(this, sw);
method.setRequestEntity(new StringRequestEntity(sw.toString(), null, null));
method.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
getHttpClient().executeMethod(method);
final InputStream is = method.getResponseBodyAsStream();
code = method.getStatusCode();
if (code != 200 && code != 201) {
throw new ProponoException("ERROR HTTP status=" + code + " : " + Utilities.streamToString(is));
}
final Entry romeEntry = Atom10Parser.parseEntry(new InputStreamReader(is), getCollection().getHrefResolved(), Locale.US);
BeanUtils.copyProperties(this, romeEntry);
} catch (final Exception e) {
final String msg = "ERROR: saving entry, HTTP code: " + code;
LOG.debug(msg, e);
throw new ProponoException(msg, e);
} finally {
method.releaseConnection();
}
final Header locationHeader = method.getResponseHeader("Location");
if (locationHeader == null) {
LOG.warn("WARNING added entry, but no location header returned");
} else if (getEditURI() == null) {
final List<Link> links = getOtherLinks();
final Link link = new Link();
link.setHref(locationHeader.getValue());
link.setRel("edit");
links.add(link);
setOtherLinks(links);
}
}