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 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
AbstractHttpContent.getType()isAtom.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
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAtomContent(XmlNamespaceDictionary namespaceDictionary, java.lang.Object entry, boolean isEntry)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AtomContentforEntry(XmlNamespaceDictionary namespaceDictionary, java.lang.Object entry)Returns a new instance of HTTP content for an Atom entry.static AtomContentforFeed(XmlNamespaceDictionary namespaceDictionary, java.lang.Object feed)Returns a new instance of HTTP content for an Atom feed.java.lang.ObjectgetData()Returns the key name/value pair data for the Atom entry or Atom feed.booleanisEntry()Returnstruefor an Atom entry orfalsefor an Atom feed.AtomContentsetMediaType(HttpMediaType mediaType)Sets the media type to use for the Content-Type header, ornullif unspecified.voidwriteTo(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
-
-
-
-
Constructor Detail
-
AtomContent
protected AtomContent(XmlNamespaceDictionary namespaceDictionary, java.lang.Object entry, boolean isEntry)
- Parameters:
namespaceDictionary- XML namespace dictionaryentry- key/value pair data for the Atom entryisEntry-truefor an Atom entry orfalsefor an Atom feed- Since:
- 1.5
-
-
Method Detail
-
forEntry
public static AtomContent forEntry(XmlNamespaceDictionary namespaceDictionary, java.lang.Object entry)
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
public static AtomContent forFeed(XmlNamespaceDictionary namespaceDictionary, java.lang.Object feed)
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
public AtomContent setMediaType(HttpMediaType mediaType)
Description copied from class:AbstractHttpContentSets the media type to use for the Content-Type header, ornullif 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:
setMediaTypein classAbstractXmlHttpContent
-
writeTo
public final void writeTo(org.xmlpull.v1.XmlSerializer serializer) throws java.io.IOExceptionDescription copied from class:AbstractXmlHttpContentWrites the content to the given XML serializer.- Specified by:
writeToin classAbstractXmlHttpContent- Throws:
java.io.IOException- I/O exception
-
isEntry
public final boolean isEntry()
Returnstruefor an Atom entry orfalsefor an Atom feed.- Since:
- 1.5
-
getData
public final java.lang.Object getData()
Returns the key name/value pair data for the Atom entry or Atom feed.- Since:
- 1.5
-
-