本文整理汇总了Java中com.rometools.rome.feed.atom.Link.setHref方法的典型用法代码示例。如果您正苦于以下问题:Java Link.setHref方法的具体用法?Java Link.setHref怎么用?Java Link.setHref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rometools.rome.feed.atom.Link
的用法示例。
在下文中一共展示了Link.setHref方法的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: buildFeedEntries
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
@Override
protected List<Entry> buildFeedEntries(Map<String, Object> model,
HttpServletRequest req, HttpServletResponse response) throws Exception {
// get data model which is passed by the Spring container
List<HrmsNews> news = (List<HrmsNews>) model.get("allNews");
List<Entry> entries = new ArrayList<Entry>(news.size());
for(HrmsNews topic : news ){
Entry entry = new Entry();
entry.setId(topic.getId()+"");
entry.setTitle(topic.getDescription());
Content summary = new Content();
summary.setValue(topic.getSummary());
entry.setSummary(summary);
Link link = new Link();
link.setType("text/html");
link.setHref(topic.getLink()); //because I have a different controller to show news at http://yourfanstasticsiteUrl.com/news/ID
List arrLinks = new ArrayList();
arrLinks.add(link);
entry.setAlternateLinks(arrLinks);
entry.setUpdated(new Date());
entries.add(entry);
}
return entries;
}
示例6: 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;
}
示例7: 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);
}
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例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.setTitle(syndLink.getTitle());
return link;
}
示例12: 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);
}
}
示例13: copyFrom
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
@Override
public void copyFrom(CopyFrom obj) {
AtomLinkModule other = (AtomLinkModule) obj;
Link link = other.getLink();
if (link != null) {
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());
setLink(l);
}
}
示例14: clone
import com.rometools.rome.feed.atom.Link; //导入方法依赖的package包/类
@Override
public Object clone() {
final AtomLinkModuleImpl m = new AtomLinkModuleImpl();
if (link != null) {
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());
m.setLink(l);
}
return m;
}
示例15: 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));
}