@SuppressWarnings("unchecked") public static SyndFeed addOpenSearchModule( SyndFeed feed, int itemsPerPage, int startIdx, int totalResult, String searchDescriptionUrl) { if (feed == null) { throw new NullPointerException("feed is NULL"); } List<Module> mods = null; mods = feed.getModules(); if (mods == null) { mods = new ArrayList<Module>(); } OpenSearchModule osm = new OpenSearchModuleImpl(); osm.setItemsPerPage(itemsPerPage); osm.setStartIndex(startIdx); osm.setTotalResults(totalResult); if (searchDescriptionUrl != null) { Link link = new Link(); link.setHref(searchDescriptionUrl); link.setType("application/opensearchdescription+xml"); osm.setLink(link); } mods.add(osm); feed.setModules(mods); return feed; }
private Link parseLink( final Feed feed, final Entry entry, final String baseURI, final Element eLink) { final Link link = new Link(); String att = getAttributeValue(eLink, "rel"); if (att != null) { link.setRel(att); } att = getAttributeValue(eLink, "type"); if (att != null) { link.setType(att); } att = getAttributeValue(eLink, "href"); if (att != null) { link.setHref(att); if (isRelativeURI(att)) { link.setHrefResolved(resolveURI(baseURI, eLink, att)); } } att = getAttributeValue(eLink, "title"); if (att != null) { link.setTitle(att); } att = getAttributeValue(eLink, "hreflang"); if (att != null) { link.setHreflang(att); } att = getAttributeValue(eLink, "length"); if (att != null) { final Long val = NumberParser.parseLong(att); if (val != null) { link.setLength(val.longValue()); } } return link; }
private Link parseLink(Element eLink) { Link link = new Link(); String att = getAttributeValue(eLink, "rel"); if (att != null) { link.setRel(att); } att = getAttributeValue(eLink, "type"); if (att != null) { link.setType(att); } att = getAttributeValue(eLink, "href"); if (att != null) { link.setHref(att); } return link; }