001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.examples.bean.atom; 018 019import static org.apache.juneau.bean.atom.AtomBuilder.*; 020 021import java.net.*; 022 023import org.apache.juneau.bean.atom.*; 024 025/** 026 * Atom feed example. 027 * 028 */ 029public class AtomFeed { 030 031 /** 032 * @return A sample Atom feed. 033 * @throws URISyntaxException Won't happen 034 */ 035 public static Feed getAtomFeed() throws URISyntaxException { 036 037 return 038 feed("tag:foo.org", "Title", "2016-12-31T05:02:03Z") 039 .setSubtitle(text("html").setText("Subtitle")) 040 .setLinks( 041 link("alternate", "text/html", "http://foo.org/").setHreflang("en"), 042 link("self", "application/atom+xml", "http://foo.org/feed.atom") 043 ) 044 .setGenerator( 045 generator("Example Toolkit").setUri("http://www.foo.org/").setVersion("1.0") 046 ) 047 .setEntries( 048 entry("tag:foo.org", "Title", "2016-12-31T05:02:03Z") 049 .setLinks( 050 link("alternate", "text/html", "http://foo.org/2005/04/02/atom"), 051 link("enclosure", "audio/mpeg", "http://foo.org/audio/foobar.mp3").setLength(1337) 052 ) 053 .setPublished("2016-12-31T05:02:03Z") 054 .setAuthors( 055 person("John Smith").setUri(new URI("http://foo.org/")).setEmail("foo@foo.org") 056 ) 057 .setContributors( 058 person("John Smith"), 059 person("Jane Smith") 060 ) 061 .setContent( 062 content("xhtml") 063 .setLang("en") 064 .setBase("http://foo.org/") 065 .setText("<div><p><i>[Sample content]</i></p></div>") 066 ) 067 ); 068 } 069}