Class AtomContent
java.lang.Object
com.google.api.client.http.AbstractHttpContent
com.google.api.client.http.xml.AbstractXmlHttpContent
com.google.api.client.http.xml.atom.AtomContent
- All Implemented Interfaces:
HttpContent
,StreamingContent
Beta
Serializes Atom XML HTTP content based on the data key/value mapping object for an Atom entry.
Default value for AbstractHttpContent.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.
- Since:
- 1.4
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AtomContent
(XmlNamespaceDictionary namespaceDictionary, Object entry, boolean isEntry) -
Method Summary
Modifier and TypeMethodDescriptionstatic AtomContent
forEntry
(XmlNamespaceDictionary namespaceDictionary, Object entry) Returns a new instance of HTTP content for an Atom entry.static AtomContent
forFeed
(XmlNamespaceDictionary namespaceDictionary, Object feed) Returns a new instance of HTTP content for an Atom feed.final Object
getData()
Returns the key name/value pair data for the Atom entry or Atom feed.final boolean
isEntry()
Returnstrue
for an Atom entry orfalse
for an Atom feed.setMediaType
(HttpMediaType mediaType) Sets the media type to use for the Content-Type header, ornull
if unspecified.final void
writeTo
(org.xmlpull.v1.XmlSerializer serializer) Writes the content to the given XML serializer.Methods inherited from class com.google.api.client.http.xml.AbstractXmlHttpContent
getNamespaceDictionary, writeTo
Methods inherited from class com.google.api.client.http.AbstractHttpContent
computeLength, computeLength, getCharset, getLength, getMediaType, getType, retrySupported
-
Field Details
-
isEntry
private final boolean isEntrytrue
for an Atom entry orfalse
for an Atom feed. -
entry
Key/value pair data for the Atom entry.
-
-
Constructor Details
-
AtomContent
- Parameters:
namespaceDictionary
- XML namespace dictionaryentry
- key/value pair data for the Atom entryisEntry
-true
for an Atom entry orfalse
for an Atom feed- Since:
- 1.5
-
-
Method Details
-
forEntry
Returns a new instance of HTTP content for an Atom entry.- Parameters:
namespaceDictionary
- XML namespace dictionaryentry
- data key/value pair for the Atom entry- Since:
- 1.5
-
forFeed
Returns a new instance of HTTP content for an Atom feed.- Parameters:
namespaceDictionary
- XML namespace dictionaryfeed
- data key/value pair for the Atom feed- Since:
- 1.5
-
setMediaType
Description copied from class:AbstractHttpContent
Sets the media type to use for the Content-Type header, ornull
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.- Overrides:
setMediaType
in classAbstractXmlHttpContent
-
writeTo
Description copied from class:AbstractXmlHttpContent
Writes the content to the given XML serializer.- Specified by:
writeTo
in classAbstractXmlHttpContent
- Throws:
IOException
- I/O exception
-
isEntry
public final boolean isEntry()Returnstrue
for an Atom entry orfalse
for an Atom feed.- Since:
- 1.5
-
getData
Returns the key name/value pair data for the Atom entry or Atom feed.- Since:
- 1.5
-