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 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
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXmlHttpContent(XmlNamespaceDictionary namespaceDictionary, String elementName, Object data) XML namespace dictionary. -
Method Summary
Modifier and TypeMethodDescriptionfinal ObjectgetData()Returns the key/value pair data.final StringReturns the XML element local name, optionally prefixed by its namespace alias, for example"atom:entry".setMediaType(HttpMediaType mediaType) Sets the media type to use for the Content-Type header, ornullif unspecified.final 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, writeToMethods inherited from class com.google.api.client.http.AbstractHttpContent
computeLength, computeLength, getCharset, getLength, getMediaType, getType, retrySupported
-
Field Details
-
elementName
XML element local name, optionally prefixed by its namespace alias, for example"atom:entry". -
data
Key/value pair data.
-
-
Constructor Details
-
XmlHttpContent
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 Details
-
writeTo
Description copied from class:AbstractXmlHttpContentWrites the content to the given XML serializer.- Specified by:
writeToin classAbstractXmlHttpContent- Throws:
IOException- I/O exception
-
setMediaType
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
-
getElementName
Returns the XML element local name, optionally prefixed by its namespace alias, for example"atom:entry".- Since:
- 1.5
-
getData
Returns the key/value pair data.- Since:
- 1.5
-