Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Info
titleImportant Note

The Atom Syndication Format data model can also be used to produce Atom Feeds and Atom Entries in HTML (text/html) and JSON (application/json) formats. For more details regarding HTML see section HTML (TBD). For JSON format see section (TBD)

Atom

...

Feed Support

The following table shows the Atom Feed data models and the representations in which the Atom data models can be serialized and de-serialized

Apache Wink provides a set of entity providers that are capable of mapping Atom Feed and Atom Entry XML documents to and from an Atom data model.

Info
titleReference

Refer to chapter ‎9 TBD for more information on Data Models.

AtomFeedProvider

Handles reading and writing of the AtomFeedProvider class for the application/atom+xml media type.

 

Supported

Media Types

Data Model

Provider registration Entity

Read

Yes

application/atom+xml

AtomFeed

Write

Yes

application/atom+xml

AtomFeed

AtomFeedSyndFeedProvider

Handles reading and writing of the AtomFeedSyndFeedProvider class for the application/atom+xml media type.

org.apache.wink
.common.model
.atom.AtomFeed

org.apache.wink
.common.model
.synd.SyndFeed

Not required. Registered by default

Write

 

Supported

Media Types

Entity

Read

Yes

application/atom+xml

SyndFeed

Write

Yes

application/atom+xml

SyndFeed

AtomFeedJAXBElementProvider


org.apache.wink
.common.model
.atom.AtomFeed

org.apache.wink
.common.model
.synd.SyndFeed

Not required. Registered by default

Atom Entry Support

The following table shows the Atom Entry data models and the representations in which it can be serialized and de-serializedHandles reading and writing of the AtomFeedJAXBElementProvider class for the application/atom+xml media type.

 

Supported

Media Types

Data Model

Provider registration Entity

Read

Yes

application/atom+xml

JAXBElement<AtomFeed>

Write

Yes

application/atom+xml

JAXBElement<AtomFeed>

AtomEntryProvider

Handles reading and writing of the AtomEntryProvider class for the application/atom+xml media type.

org.apache.wink
.common.model
.atom.AtomEntry

org.apache.wink
.common.model
.synd.SyndEntry

Not required. Registered by default

Write

 

Supported

Media Types

Entity

Read

Yes

application/atom+xml

AtomEntry

Write

Yes

application/atom+xml

AtomEntry

AtomEntrySyndEntryProvider

Handles reading and writing of the AtomEntrySyndEntryProvider class for the application/atom+xml media type.

 

Supported

Media Types

Entity

Read

Yes

application/atom+xml

SyndEntry

Write

Yes

application/atom+xml

SyndEntry

AtomEntryJAXBElementProvider

Handles reading and writing of the AtomEntryJAXBElementProvider class for the application/atom+xml media type.

 

Supported

Media Types

Entity

Read

Yes

application/atom+xml

JAXBElement<AtomEntry>

Write

Yes

application/atom+xml

JAXBElement<AtomEntry>

Atom Data Models

...

org.apache.wink
.common.model
.atom.AtomEntry

org.apache.wink
.common.model
.synd.SyndEntry

Not required. Registered by default

Examples

The following code example demonstrates reading and writing of Atom Feeds  and Atom Entries.

Producing Atom Feed

The following code example demonstrates the creation of an Atom Feed.

Code Block

    @GET
    @Produces(MediaType.APPLICATION_ATOM_XML)
    public AtomFeed getFeed() {
        AtomFeed feed = new AtomFeed();
        feed.setId("http://example.com/atomfeed");
        feed.setTitle(new AtomText("Example"));
        feed.setUpdated(new Date());
        AtomLink link1 = new AtomLink();
        ...

        return feed;
    }
}

Consuming Atom Feed

The following code example demonstrates the consumption of an Atom Feed.

Code Block

    @POST
    @Consumes(MediaType.APPLICATION_ATOM_XML)
    public void setFeed(AtomFeed feed) {
        ...

        return;
    }

Producing Atom Entry

The following code example demonstrates the creation of an Atom Entry.

Code Block

    @GET
    @Produces(MediaType.APPLICATION_ATOM_XML)
    public AtomEntry getEntry() {
        AtomEntry entry = new AtomEntry();
        entry.setId("http://example.com/entry");
        entry.setTitle(new AtomText("Web Demo"));
        entry.getLinks().add(link2);
        entry.setUpdated(new Date());
        entry.setPublished(new Date());
        ...
        return entry;
    }

Consuming Atom Entry

The following code example demonstrates the consumption of an Atom Entry.

Code Block

    @POST
    @Consumes(MediaType.APPLICATION_ATOM_XML)
    public void setEntry(AtomEntry entry) {
        ...

        return;
   }