Package com.google.api.client.http.xml
Class XmlHttpContent
- java.lang.Object
-
- com.google.api.client.http.AbstractHttpContent
-
- com.google.api.client.http.xml.AbstractXmlHttpContent
-
- com.google.api.client.http.xml.XmlHttpContent
-
- All Implemented Interfaces:
HttpContent
,StreamingContent
@Beta public class XmlHttpContent extends AbstractXmlHttpContent
Beta
Serializes XML HTTP content based on the data key/value mapping object for an item.Sample usage:
static void setContent(HttpRequest request, XmlNamespaceDictionary namespaceDictionary, String elementName, Object data) { request.setContent(new XmlHttpContent(namespaceDictionary, elementName, data)); }
Implementation is not thread-safe.
- Since:
- 1.0
- Author:
- Yaniv Inbar
-
-
Constructor Summary
Constructors Constructor Description XmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data)
XML namespace dictionary.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getData()
Returns the key/value pair data.String
getElementName()
Returns the XML element local name, optionally prefixed by its namespace alias, for example"atom:entry"
.XmlHttpContent
setMediaType(HttpMediaType mediaType)
Sets the media type to use for the Content-Type header, ornull
if unspecified.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
-
-
-
-
Constructor Detail
-
XmlHttpContent
public XmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data)
XML namespace dictionary.- Parameters:
namespaceDictionary
- XML namespace dictionaryelementName
- XML element local name, optionally prefixed by its namespace alias, for example"atom:entry"
data
- Key/value pair data- Since:
- 1.5
-
-
Method Detail
-
writeTo
public final void writeTo(org.xmlpull.v1.XmlSerializer serializer) throws IOException
Description copied from class:AbstractXmlHttpContent
Writes the content to the given XML serializer.- Specified by:
writeTo
in classAbstractXmlHttpContent
- Throws:
IOException
- I/O exception
-
setMediaType
public XmlHttpContent setMediaType(HttpMediaType mediaType)
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
-
getElementName
public final String getElementName()
Returns the XML element local name, optionally prefixed by its namespace alias, for example"atom:entry"
.- Since:
- 1.5
-
getData
public final Object getData()
Returns the key/value pair data.- Since:
- 1.5
-
-