Class AtomContent (1.42.0)

public class AtomContent extends AbstractXmlHttpContent

Beta
Serializes Atom XML HTTP content based on the data key/value mapping object for an Atom entry.

Default value for #getType() is Atom#MEDIA_TYPE.

Sample usages:

static void setAtomEntryContent( HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object entry) { request.setContent(AtomContent.forEntry(namespaceDictionary, entry)); }

static void setAtomBatchContent( HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object batchFeed) { request.setContent(AtomContent.forFeed(namespaceDictionary, batchFeed)); }

Implementation is not thread-safe.

Inheritance

Object > AbstractHttpContent > AbstractXmlHttpContent > AtomContent

Static Methods

forEntry(XmlNamespaceDictionary namespaceDictionary, Object entry)

public static AtomContent forEntry(XmlNamespaceDictionary namespaceDictionary, Object entry)

Returns a new instance of HTTP content for an Atom entry.

Parameters
NameDescription
namespaceDictionaryXmlNamespaceDictionary

XML namespace dictionary

entryObject

data key/value pair for the Atom entry

Returns
TypeDescription
AtomContent

forFeed(XmlNamespaceDictionary namespaceDictionary, Object feed)

public static AtomContent forFeed(XmlNamespaceDictionary namespaceDictionary, Object feed)

Returns a new instance of HTTP content for an Atom feed.

Parameters
NameDescription
namespaceDictionaryXmlNamespaceDictionary

XML namespace dictionary

feedObject

data key/value pair for the Atom feed

Returns
TypeDescription
AtomContent

Constructors

AtomContent(XmlNamespaceDictionary namespaceDictionary, Object entry, boolean isEntry)

protected AtomContent(XmlNamespaceDictionary namespaceDictionary, Object entry, boolean isEntry)
Parameters
NameDescription
namespaceDictionaryXmlNamespaceDictionary

XML namespace dictionary

entryObject

key/value pair data for the Atom entry

isEntryboolean

true for an Atom entry or false for an Atom feed

Methods

getData()

public final Object getData()

Returns the key name/value pair data for the Atom entry or Atom feed.

Returns
TypeDescription
Object

isEntry()

public final boolean isEntry()

Returns true for an Atom entry or false for an Atom feed.

Returns
TypeDescription
boolean

setMediaType(HttpMediaType mediaType)

public AtomContent setMediaType(HttpMediaType mediaType)

Sets the media type to use for the Content-Type header, or null if unspecified.

This will also overwrite any previously set parameter of the media type (for example "charset"), and therefore might change other properties as well.

Parameter
NameDescription
mediaTypeHttpMediaType
Returns
TypeDescription
AtomContent
Overrides

writeTo(XmlSerializer serializer)

public final void writeTo(XmlSerializer serializer)

Writes the content to the given XML serializer.

Parameter
NameDescription
serializerorg.xmlpull.v1.XmlSerializer
Overrides Exceptions
TypeDescription
IOException